/**
  * @return zero-based indices that should also be removed due to cascading. (These will already
  *     have had 1 subtracted from them, since we know that a search from above is being deleted)
  */
 private synchronized List<Integer> removeSearchItemHelper(int i) {
   // 1. Decrement any number in a CohortHistoryCompositionFilter that's greater than i.
   // 2. If any CohortHistoryCompositionFilter references search i, we'll have to cascade delete it
   List<Integer> ret = new ArrayList<Integer>();
   for (int j = i + 1; j < searchHistory.size(); ++j) {
     PatientSearch ps = searchHistory.get(j);
     if (ps.isComposition()) {
       cachedFilters.set(i, null); // this actually only needs to happen if the filter is affected
       // note that i is zero-based, but in a composition filter it would be one-based
       boolean removeMeToo = ps.removeFromHistoryNotify(i + 1);
       if (removeMeToo) ret.add(j - 1);
     }
   }
   return ret;
 }