public override async Task <AddUserResponse> AddUser(AddUserRequest request, ServerCallContext context) { if (!Guid.TryParse(request.CustomerId.Value, out Guid customerId)) { throw new RpcException( Status.DefaultCancelled, $"Could not parse {nameof(request.CustomerId)}" ); } var user = new User { Id = Guid.NewGuid(), CustomerId = customerId, Username = request.Username, Firstname = request.Firstname, Lastname = request.Lastname, StatusId = request.StatusId }; using (var dbContext = new SecurityDbContext(this.securityDbContextOptions)) { await dbContext.AddAsync(user); await dbContext.SaveChangesAsync(); } return(await Task.FromResult(new AddUserResponse { Id = new UUID { Value = user.Id.ToString() } })); }