code: @SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") // agreed PMD, fixme
  	private void clean(RallyCollector collector, List<RallyProject> existingProjects) {
  		Set<ObjectId> uniqueIDs = new HashSet<>();
  		for (com.capitalone.dashboard.model.Component comp : dbComponentRepository.findAll()) {
  			if (comp.getCollectorItems() != null && !comp.getCollectorItems().isEmpty()) {
  				List<CollectorItem> itemList = comp.getCollectorItems().get(CollectorType.AgileTool);
  				if (itemList != null) {
  					for (CollectorItem ci : itemList) {
  						if (ci != null && ci.getCollectorId().equals(collector.getId())) {
  							uniqueIDs.add(ci.getId());
  						}
  					}
  				}
  			}
  		}
  		List<RallyProject> stateChangeJobList = new ArrayList<>();
  		Set<ObjectId> udId = new HashSet<>();
  		udId.add(collector.getId());
  		for (RallyProject job : existingProjects) {
  			// collect the jobs that need to change state : enabled vs disabled.
  			if ((job.isEnabled() && !uniqueIDs.contains(job.getId())) || // if
  			// it
  			// was
  			// enabled
  			// but
  			// not
  			// on
  			// a
  			// dashboard
  					(!job.isEnabled() && uniqueIDs.contains(job.getId()))) { // OR
  				// it
  				// was
  				// disabled
  				// and
  				// now
  				// on
  				// a
  				// dashboard
  				job.setEnabled(uniqueIDs.contains(job.getId()));
  				stateChangeJobList.add(job);
  			}
  		}
  		if (!CollectionUtils.isEmpty(stateChangeJobList)) {
  			rallyProjectRepository.save(stateChangeJobList);
  		}
  	}
docs: Clean up unused rally collector items
  
  @param collector
  the {@link RallyCollector}