public async Task <IHttpActionResult> SendEmail(EmailToSend emailToSend) { var receiverId = await _emailRepository.GetIdOfReceiver(emailToSend.ReceiverEmail); var emailToCreate = new Email { Subject = emailToSend.Subject, Message = emailToSend.Message, SenderId = emailToSend.SenderId, ReceiverId = receiverId }; await _emailRepository.SendEmail(emailToCreate); return(StatusCode((HttpStatusCode)201)); }