void clearStacks(boolean clearGlobal, @NotNull Set<? extends DocumentReference> refs) {
    for (UndoRedoList<UndoableGroup> each : getAffectedStacks(clearGlobal, refs)) {
      while(!each.isEmpty()) {
        clearStacksFrom(each.getLast());
      }
    }
    removeEmptyStacks();
  }
void clearStacks(boolean clearGlobal, @NotNull Set<? extends DocumentReference> refs)