public async Task <IActionResult> AcceptInvitationAsync(InvitationId invitationId) { var userId = HttpContext.GetUserId(); var invitation = await _invitationService.FindInvitationAsync(invitationId); if (invitation == null) { return(this.NotFound("The invitation was not found.")); } var result = await _invitationService.AcceptInvitationAsync(invitation, userId); if (result.IsValid) { return(this.Ok("The invitation has been accepted.")); } result.AddToModelState(ModelState); return(this.BadRequest(new ValidationProblemDetails(ModelState))); }