public User createUser(String username, String password, String firstName, String lastName) throws CaseboxException {
User user = userRepository.findByUsername(username);
if (user != null) {
log.error("Username {} already exist, can not create user.", new Object[] {username});
throw new CaseboxException("error.user.alreadyexist");
}
user = new User(username, password, true, firstName, lastName);
Authority authority = new Authority(user, AuthorityRole.ROLE_USER);
user.getAuthorities().add(authority);