code: @SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts")
      private void clean(XLDeployCollector collector) {
      	deleteUnwantedJobs(collector);
          Set<ObjectId> uniqueIDs = new HashSet<>();
          for (com.capitalone.dashboard.model.Component comp : dbComponentRepository
                  .findAll()) {
              if (comp.getCollectorItems() == null || comp.getCollectorItems().isEmpty()) continue;
              List<CollectorItem> itemList = comp.getCollectorItems().get(
                      CollectorType.Deployment);
              if (itemList == null) continue;
              for (CollectorItem ci : itemList) {
                  if (ci == null) continue;
                  uniqueIDs.add(ci.getId());
              }
          }
          List<XLDeployApplication> appList = new ArrayList<>();
          Set<ObjectId> udId = new HashSet< >();
          udId.add(collector.getId());
          for (XLDeployApplication app : xlDeployApplicationRepository.findByCollectorIdIn(udId)) {
              if (app != null) {
                  app.setEnabled(uniqueIDs.contains(app.getId()));
                  appList.add(app);
              }
          }
          xlDeployApplicationRepository.save(appList);
      }
docs: Clean up unused deployment collector items
  
  @param collector the {@link XLDeployCollector}