class OkrBranchService {

  public OkrBranch update(long branchId, OkrBranch okrBranch, User user) {
    throwIdDeviationExceptionIfIdsAreDeviating(branchId, okrBranch);
    OkrBranch persistedEntity = okrBranchRepository.findByIdOrThrow(branchId);
    persistedEntity.setName(okrBranch.getName());
    persistedEntity.setParentOkrUnit(okrBranch.getParentOkrUnit());
    persistedEntity.setOkrChildUnits(okrBranch.getOkrChildUnits());
    persistedEntity.setObjectives(okrBranch.getObjectives());
    okrBranchRepository.save(persistedEntity);
    logger.info("Update OkrBranch " + okrBranch.getName() + " (id: " + okrBranch.getId() + ")");
    activityService.createActivity(user, okrBranch, Action.EDITED);
    return persistedEntity;
  }

  @Autowired public  OkrBranchService(
      OkrBranchRepository okrBranchRepository, ActivityService activityService);

}