public async Task<IHttpActionResult> Invite(int groupId, [FromBody]ApplicationUserDto invitedApplicationUserDto) { try { var senderId = User.Identity.GetUserId(); await _userGroupService.AddInviteAsync(senderId, invitedApplicationUserDto.Id, groupId); return Ok(); } catch (ServiceException e) { if (e.Code == ErrorCodes.BadRequest) { return BadRequest(); } if (e.Code == ErrorCodes.EntityNotFound) { return NotFound(); } return InternalServerError(); } }