code: private void cancelDiscardedDirectories(final Directory pDiscardedParent,
                                              final Collection<Directory> pToBeConverted) {
          final Collection<Directory> toBeDiscarded = new LinkedList<>();
          dirs.values().removeIf(dir -> {
              if (pDiscardedParent.isDirectParentOf(dir)) {
                  if (dir.hasKeys()) {
                      pToBeConverted.add(dir);
                  } else {
                      toBeDiscarded.add(dir);
                      dir.cancelKey();
                      return true;
                  }
              }
              return false;
          });
          toBeDiscarded.forEach(dir -> cancelDiscardedDirectories(dir, pToBeConverted));
      }
docs: Recursively traverses the registered directories. Directories which were not roots sometime in the past will
  be cancelled and removed. If a directory was a root (known by {@link Directory#hasKeys()}), then it will be
  added to the list specified. This list contains sub-directories which need to be converted back into
  root directories.
  
  @param pDiscardedParent Parent directory which was discarded, never {@code null}
  @param pToBeConverted   List of sub-directories which need to be converted into root-directories, never {@code null}