//adding new register to the database.. public UserBasicDTO RegisterUser(UserRegisterDTO userRegisterDTO) { try { if (UserDBObject.UserEmailExists(userRegisterDTO.Email)) { throw new UserNameAlreadyExistsException(); } } catch (NotFoundException ex) { userRegisterDTO.HashPassword = PasswordHasher.PasswordHashing(userRegisterDTO.Password); UserBasicDTO newuserBasicDTO = UserDBObject.AddUser(userRegisterDTO); return(newuserBasicDTO); } catch (UserNameAlreadyExistsException ex) { throw new UserNameAlreadyExistsException(); } catch (Exception ex) { throw new Exception(); } return(null); }