if(profile == null || profile.getId() == null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "request object must provide profile information with valid id.");
}
User newUser = identityService.newUser(profile.getId());
profile.update(newUser);
if(userDto.getCredentials() != null) {
newUser.setPassword(userDto.getCredentials().getPassword());
}