public User createUser(User user) {
    if (userRepository.hasDuplicatedName(user)) {
      throw new GroupyException(Response.Status.CONFLICT, "Duplicated name");
    }

    UserEntity newUserEntity =
        new UserEntity().setName(user.getName()).setPassword(user.getPassword());

    userRepository.save(newUserEntity);

    user.setUuid(newUserEntity.getUuid());
    return user;
  }
  public List<User> findGroupUsersByUuids(UUID groupUuid, List<UUID> userUuids) {
    if (userUuids.isEmpty()) {
      return new ArrayList<>();
    }

    List<Tuple> usersWithRoles =
        userRepository.findUsersWithRolesByGroupAndIds(groupUuid, userUuids);
    return usersWithRoles
        .stream()
        .map(
            tuple -> {
              User user = dtoMapper.toUserWithoutGroup(tuple.get(QUserEntity.userEntity));
              return user.setRole(tuple.get(QUserGroupEntity.userGroupEntity.userRole));
            })
        .collect(Collectors.toList());
  }