@Nullable
  @Override
  public Element getSerializedState(
      @NotNull Boolean storageData,
      Object component,
      @NotNull String componentName,
      boolean archive) {
    if (storageData) {
      return null;
    }

    Element element = new Element("component");
    ModifiableRootModel model = null;
    AccessToken token = ReadAction.start();
    try {
      model = ((ModuleRootManagerImpl) component).getModifiableModel();
      // IDEA-137969 Eclipse integration: external remove of classpathentry is not synchronized
      model.clear();
      try {
        myConverter.readClasspath(model);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      ((RootModelImpl) model).writeExternal(element);
    } catch (WriteExternalException e) {
      LOG.error(e);
    } finally {
      try {
        token.finish();
      } finally {
        if (model != null) {
          model.dispose();
        }
      }
    }

    if (myPathMacroSubstitutor != null) {
      myPathMacroSubstitutor.expandPaths(element);
      myPathMacroSubstitutor.addUnknownMacros(
          "NewModuleRootManager", PathMacrosCollector.getMacroNames(element));
    }

    getStorageDataRef().set(true);
    return element;
  }