public static void replaceLibrary(@NotNull ModifiableRootModel model, @NotNull Library oldLibrary, @NotNull Library newLibrary) {
    int i = findLibraryOrderEntry(model.getOrderEntries(), oldLibrary);
    if (i == -1) return;

    model.addLibraryEntry(newLibrary);
    replaceLibraryByAdded(model, i);
  }
public static void replaceLibrary(@NotNull ModifiableRootModel model, @NotNull Library oldLibrary, @NotNull Library newLibrary)