@Nullable
  public static MavenDomDependency searchManagingDependency(
      @NotNull final MavenDomDependency dependency, @NotNull final Project project) {
    final DependencyConflictId depId = DependencyConflictId.create(dependency);
    if (depId == null) return null;

    final MavenDomProjectModel model =
        dependency.getParentOfType(MavenDomProjectModel.class, false);
    if (model == null) return null;

    final Ref<MavenDomDependency> res = new Ref<MavenDomDependency>();

    Processor<MavenDomDependency> processor =
        dependency1 -> {
          if (depId.equals(DependencyConflictId.create(dependency1))) {
            res.set(dependency1);
            return true;
          }

          return false;
        };

    processDependenciesInDependencyManagement(model, processor, project);

    return res.get();
  }
  @NotNull
  public static Set<MavenDomDependency> searchDependencyUsages(
      @NotNull final MavenDomProjectModel model,
      @NotNull final DependencyConflictId dependencyId,
      @NotNull final Set<MavenDomDependency> excludes) {
    Project project = model.getManager().getProject();
    final Set<MavenDomDependency> usages = new HashSet<MavenDomDependency>();
    Processor<MavenDomProjectModel> collectProcessor =
        mavenDomProjectModel -> {
          for (MavenDomDependency domDependency :
              mavenDomProjectModel.getDependencies().getDependencies()) {
            if (excludes.contains(domDependency)) continue;

            if (dependencyId.equals(DependencyConflictId.create(domDependency))) {
              usages.add(domDependency);
            }
          }
          return false;
        };

    processChildrenRecursively(
        model, collectProcessor, project, new HashSet<MavenDomProjectModel>(), true);

    return usages;
  }