code: @SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") // agreed, fixme
      private void clean(Collector collector) {
          Set<ObjectId> uniqueIDs = new HashSet<>();
          /*
            Logic: For each component, retrieve the collector item list of the type SCM.
            Store their IDs in a unique set ONLY if their collector IDs match with GitHub collectors ID.
           */
          for (com.capitalone.dashboard.model.Component comp : dbComponentRepository.findAll()) {
              if (!MapUtils.isEmpty(comp.getCollectorItems())) {
                  List<CollectorItem> itemList = comp.getCollectorItems().get(CollectorType.SCM);
                  if (itemList != null) {
                      itemList.stream().filter(ci -> ci != null && Objects.equals(ci.getCollectorId(), collector.getId())).map(BaseModel::getId).forEach(uniqueIDs::add);
                  }
              }
          }
          /*
            Logic: Get all the collector items from the collector_item collection for this collector.
            If their id is in the unique set (above), keep them enabled; else, disable them.
           */
          List<GitHubRepo> repoList = new ArrayList<>();
          Set<ObjectId> gitID = new HashSet<>();
          gitID.add(collector.getId());
          gitHubRepoRepository.findByCollectorIdIn(gitID).stream().filter(Objects::nonNull).forEach(repo -> {
              if (repo.isPushed()) {return;}
              repo.setEnabled(uniqueIDs.contains(repo.getId()));
              repoList.add(repo);
          });
          gitHubRepoRepository.save(repoList);
      }
docs: Clean up unused deployment collector items
  
  @param collector the {@link Collector}