class OrganizationManager {

  @Transactional(rollbackOn = {RuntimeException.class, ApiException.class})
  public Organization create(Organization newOrganization)
      throws NotFoundException, ConflictException, ServerException {
    requireNonNull(newOrganization, "Required non-null organization");
    requireNonNull(newOrganization.getName(), "Required non-null organization name");

    String qualifiedName;
    if (newOrganization.getParent() != null) {
      final Organization parent = getById(newOrganization.getParent());
      qualifiedName = parent.getQualifiedName() + "/" + newOrganization.getName();
    } else {
      qualifiedName = newOrganization.getName();
    }
    checkNameReservation(qualifiedName);

    final OrganizationImpl organization =
        new OrganizationImpl(
            NameGenerator.generate("organization", 16), qualifiedName, newOrganization.getParent());
    organizationDao.create(organization);
    addFirstMember(organization);
    eventService.publish(new OrganizationPersistedEvent(organization)).propagateException();
    return organization;
  }

  @Inject public  OrganizationManager(
      EventService eventService,
      OrganizationDao organizationDao,
      MemberDao memberDao,
      @Named("che.auth.reserved_user_names") String[] reservedNames);

}