public Reply Send(FriendData friendData) { try { _sessionService.Validate(friendData.UserId, friendData.SessionToken); } catch (InvalidSessionException) { return(new Reply(HttpStatusCode.BadRequest, "Invalid session")); } var sendingFriendRequestResult = _friendRequestService.Send(friendData.UserId, friendData.FriendId); if (sendingFriendRequestResult.Status == FriendRequestSendStatus.Sent || sendingFriendRequestResult.Status == FriendRequestSendStatus.Restored) { _notificationService.SendFriendRequestPush(friendData.UserId, sendingFriendRequestResult.Request); } return(new SendFriendRequestResponse(sendingFriendRequestResult.Status) { Details = new FriendRequest { FriendRequestId = sendingFriendRequestResult.Request.FriendRequestId, FriendRequestState = sendingFriendRequestResult.Status.ToString() } }); }