@Override
  protected Map<OrderEntry, OrderAware> importData(@NotNull Collection<? extends DataNode<LibraryDependencyData>> nodesToImport,
                                                   @NotNull Module module,
                                                   @NotNull IdeModifiableModelsProvider modelsProvider) {
    // The general idea is to import all external project library dependencies and module libraries which don't present at the
    // ide side yet and remove all project library dependencies and module libraries which present at the ide but not at
    // the given collection.
    // The trick is that we should perform module settings modification inside try/finally block against target root model.
    // That means that we need to prepare all necessary data, obtain a model and modify it as necessary.
    DataToImport toImport = preProcessData(nodesToImport);

    Map<OrderEntry, OrderAware> orderEntryDataMap = new LinkedHashMap<>();
    ModifiableRootModel modifiableRootModel = modelsProvider.getModifiableRootModel(module);

    for (OrderEntry entry : modifiableRootModel.getOrderEntries()) {
      LibraryDependencyData processingResult = null;
      if (OrderEntryUtil.isModuleLibraryOrderEntry(entry)) {
        processingResult = importModuleLibraryOrderEntry((LibraryOrderEntry)entry, toImport.moduleLibraries, modifiableRootModel,
                                                         modelsProvider);
      }
      else if (entry instanceof LibraryOrderEntry libraryOrderEntry) {
        processingResult = importLibraryOrderEntry(libraryOrderEntry, toImport.projectLibraries, modifiableRootModel, modelsProvider,
                                                   toImport.hasUnresolvedLibraries);
        if (processingResult != null) {
          libraryOrderEntry.setExported(processingResult.isExported());
          libraryOrderEntry.setScope(processingResult.getScope());
        }
      }
      if (processingResult != null) {
        orderEntryDataMap.put(entry, processingResult);
      }
    }

    // Import missing library dependencies.
    for (LibraryDependencyData dependencyData : toImport.projectLibraries.values()) {
      OrderEntry entry = importMissingLibraryOrderEntry(dependencyData, modifiableRootModel, modelsProvider, module);
      orderEntryDataMap.put(entry, dependencyData);
    }
    for (LibraryDependencyData dependencyData : toImport.moduleLibraries.values()) {
      OrderEntry entry = importMissingModuleLibraryOrderEntry(dependencyData, modifiableRootModel, modelsProvider,
                                                              module);
      orderEntryDataMap.put(entry, dependencyData);
    }
    return orderEntryDataMap;
  }
@Override
  protected Map<OrderEntry, OrderAware> importData(@NotNull Collection<? extends DataNode<LibraryDependencyData>> nodesToImport,
                                                   @NotNull Module module,
                                                   @NotNull IdeModifiableModelsProvider modelsProvider)