private static void renameLibrary(final Sdk sdk, final String previousName) {
    ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> {
      final LibraryTable.ModifiableModel libraryTableModel =
        ModifiableModelsProvider.getInstance().getLibraryTableModifiableModel();
      final Library library = libraryTableModel.getLibraryByName(PythonFacetUtil.getFacetLibraryName(previousName));
      if (library != null) {
        final Library.ModifiableModel model = library.getModifiableModel();
        model.setName(PythonFacetUtil.getFacetLibraryName(sdk.getName()));
        model.commit();
      }
      libraryTableModel.commit();
    }), ModalityState.nonModal());
  }
private static void renameLibrary(final Sdk sdk, final String previousName)