private static @Nullable LibraryDependencyData importLibraryOrderEntry(
    @NotNull LibraryOrderEntry entry,
    @NotNull Map<String/* library name + scope */, LibraryDependencyData> projectLibrariesToImport,
    @NotNull ModifiableRootModel modifiableRootModel,
    @NotNull IdeModifiableModelsProvider modelsProvider,
    boolean hasUnresolvedLibraries
  ) {
    String libraryName = entry.getLibraryName();
    LibraryDependencyData existing = projectLibrariesToImport.remove(libraryName + entry.getScope().name());
    if (existing != null) {
      if (modelsProvider.findModuleByPublication(existing.getTarget()) == null) {
        return existing;
      }
      else {
        modifiableRootModel.removeOrderEntry(entry);
      }
    }
    else if (!hasUnresolvedLibraries) {
      // There is a possible case that a project has been successfully imported from external model and after
      // that network/repo goes down. We don't want to drop existing binary mappings then.
      modifiableRootModel.removeOrderEntry(entry);
    }
    return null;
  }
private static @Nullable LibraryDependencyData importLibraryOrderEntry(
    @NotNull LibraryOrderEntry entry,
    @NotNull Map<String/* library name + scope */, LibraryDependencyData> projectLibrariesToImport,
    @NotNull ModifiableRootModel modifiableRootModel,
    @NotNull IdeModifiableModelsProvider modelsProvider,
    boolean hasUnresolvedLibraries
  )