@Override
      public void visitElement(@NotNull RefEntity elem) {
        if (elem instanceof RefElement refElement) {
          entitiesWithParents.put(refElement, refElement.getInReferences());
          if (refElement.getInReferences().isEmpty() || refElement.getInReferences().contains(refElement)) {
            roots.add(refElement);
          }
        }
      }
@Override
      public void visitElement(@NotNull RefEntity elem)