void trimStacks(@NotNull Iterable<? extends DocumentReference> references) {
    for (DocumentReference reference : references) {
      trimInvalid(getStack(reference));
    }
    removeEmptyStacks();
  }
void trimStacks(@NotNull Iterable<? extends DocumentReference> references)