public static AuthResponse FailureAuthResponse(IdentityResult identityResult, string errorCode) { var response = new AuthResponse(); response.Success = false; string message = string.Empty; foreach (var error in identityResult.Errors) { message += error.Description + Environment.NewLine; } response.SetMessage(message); response.SetErrorCode(errorCode); return(response); }