public override async Task <AccountRegistrationResponse> RegisterAccount(AccountRegistrationRequest request, ServerCallContext context) { RedisUserModel user = await RedisUserModel.GetUserFromUsername(request.Username); if (user != null) { return new AccountRegistrationResponse() { Status = ResponseFactory.createResponse(ResponseType.DUPLICATE) } } ; // Create a new user model RedisUserModel model = new RedisUserModel(request); await model.SaveToDatabase(); string token = JwtManager.GenerateToken(model.UserModel.Id); context.ResponseTrailers.Add("Authorization", token); return(new AccountRegistrationResponse { Token = token, User = model.asUser(), Status = ResponseFactory.createResponse(ResponseType.SUCCESS), }); } }