public ActionResult RegisterAPI(RegisterDto registerRequest) { registerRequest = SanitizeRegisterDto.Sanitize(registerRequest); if (registerRequest.Errored) { return(BadRequest(registerRequest.ErrorMessages)); } //Register in service var RegistrationService = new Signup(); RegistrationService.SignupAccountAndUser(registerRequest); if (RegistrationService.Errored) { return(BadRequest(RegistrationService.ErrorMessages)); } //Authenticate and retrieve token var authenticator = new Authenticater(); authenticator.AuthenticateSignin(registerRequest.Password, registerRequest.Email); if (authenticator.Errored) { return(BadRequest(authenticator.ErrorMessages)); } return(Ok(authenticator.Token)); }