public BindingResult register(RegisterUserDto registerUserDto)
throws UnexpectedErrorException, NoConnectionException {
BindingResult result = new BeanPropertyBindingResult(registerUserDto, "newUser");
BindingResult jcErrors = new BeanPropertyBindingResult(registerUserDto, "newUser");
validator.validate(registerUserDto, jcErrors);
UserDto userDto = registerUserDto.getUserDto();
String encodedPassword = (userDto.getPassword() == null || userDto.getPassword().isEmpty()) ? ""
: encryptionService.encryptPassword(userDto.getPassword());
userDto.setPassword(encodedPassword);
registerByPlugin(userDto, true, result);
mergeValidationErrors(jcErrors, result);
if (!result.hasErrors()) {
registerByPlugin(userDto, false, result);
// because next http call can fail (in the interim another user was registered)