code: void validatePackage(EntityType entityType) {
      Package pack = entityType.getPackage();
      if (pack != null
          && isSystemPackage(pack)
          && !systemEntityTypeRegistry.hasSystemEntityType(entityType.getId())) {
        throw new MolgenisValidationException(
            new ConstraintViolation(
                format(
                    "Adding entity [%s] to system package [%s] is not allowed",
                    entityType.getId(), pack.getId())));
      }
    }
docs: Validate that non-system entities are not assigned to a system package
  
  @param entityType entity type