@RequestMapping(method = RequestMethod.GET, value = "/member/")
 public List<UserGroupDTO> loadUserGroupsWhereUserIsMember(
     @PathVariable("userId") final int userId, final Principal principal) {
   return dtoService.transformUserGroups(
       userGroupService.loadUserGroupsWhereUserIsMember(userService.load(userId)),
       getUser(principal));
 }
 @RequestMapping(method = RequestMethod.GET, value = "/")
 public List<UserGroupEditDTO> userGroupList(final @PathVariable("userId") int userId) {
   final List<UserGroup> userGroups =
       userGroupService.loadUserGroupsWhereUserIsOwner(userService.load(userId));
   final Function<UserGroup, UserGroupEditDTO> mapper =
       userGroup -> {
         final UserGroupEditDTO dto = new UserGroupEditDTO();
         dto.setUserGroupId(userGroup.getId());
         dto.setUserGroupName(userGroup.getGroupName());
         dto.setCupIds(
             userGroupService
                 .loadCups(userGroup)
                 .stream()
                 .map(AbstractEntity::getId)
                 .collect(Collectors.toList()));
         return dto;
       };
   return userGroups.stream().map(mapper).collect(Collectors.toList());
 }
 private UserGroup save(final int userId, final UserGroupEditDTO dto, final UserGroup userGroup) {
   final User groupOwner = userService.load(userId);
   userGroup.setOwner(groupOwner);
   userGroup.setGroupName(dto.getUserGroupName());
   return userGroupService.save(userGroup, dto.getCupIds());
 }