class OrganizationManager {

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

    final OrganizationImpl organization = organizationDao.getById(organizationId);
    final String oldQualifiedName = organization.getQualifiedName();
    final String oldName = organization.getName();

    final String newName = update.getName();
    final String newQualifiedName = buildQualifiedName(oldQualifiedName, update.getName());

    checkNameReservation(newQualifiedName);
    organization.setQualifiedName(newQualifiedName);

    organizationDao.update(organization);
    if (!newName.equals(oldName)) {
      updateSuborganizationsQualifiedNames(oldQualifiedName, organization.getQualifiedName());

      final String performerName = EnvironmentContext.getCurrent().getSubject().getUserName();
      // should be DTO as it sent via json rpc
      eventService.publish(
          asDto(new OrganizationRenamedEvent(performerName, oldName, newName, organization)));
    }
    return organization;
  }

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

}