public void setLevel(String level) {
    String levelBefore = getLevel();
    this.update(
      () -> myLevel = level,
      (builder, entity) -> {
        if (levelBefore.equals(level)) return;
        builder.modifyEntity(LibraryFilesPackagingElementEntity.Builder.class, entity, ent -> {
          LibraryId libraryId = ent.getLibrary();
          if (libraryId != null) {
            LibraryTableId newTableId;
            if ("project".equals(level)) {
              newTableId = LibraryTableId.ProjectLibraryTableId.INSTANCE;
            }
            else if ("module".equals(level)) {
              throw new RuntimeException("Cannot set module level without module name");
            }
            else {
              newTableId = new LibraryTableId.GlobalLibraryTableId(level);
            }
            ent.setLibrary(libraryId.copy(libraryId.getName(), newTableId));
          }
          return Unit.INSTANCE;
        });
      }
    );
  }
public void setLevel(String level)