class OrganizationManager {

  @Transactional(rollbackOn = {RuntimeException.class, ApiException.class})
  public void remove(String organizationId) throws ServerException {
    requireNonNull(organizationId, "Required non-null organization id");
    try {
      OrganizationImpl organization = organizationDao.getById(organizationId);
      eventService
          .publish(new BeforeAccountRemovedEvent(organization.getAccount()))
          .propagateException();
      eventService.publish(new BeforeOrganizationRemovedEvent(organization)).propagateException();
      removeSuborganizations(organizationId);
      final List<String> members = removeMembers(organizationId);
      organizationDao.remove(organizationId);
      final String initiator = EnvironmentContext.getCurrent().getSubject().getUserName();
      eventService.publish(asDto(new OrganizationRemovedEvent(initiator, organization, members)));
    } catch (NotFoundException e) {
      // organization is already removed
    }
  }

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

}