public async Task <IHttpActionResult> FindMessagesAsync(FindMessagesBindingModel model) { var allMessages = await _messagesRepository.GetAllMessagesAsync(); var result = allMessages.OrderByDescending(x => x.SentOn).Skip(model.PageNumber * 10 - 10).Take(10).Select(x => new MessageReadModel { Id = x.Id, Subject = x.Subject, Content = x.Content, SentOn = x.SentOn.ToString("dd.MM.yyyy"), RecipientNames = x.MessageRecipients.Select(y => y.Recipient.UserName).ToList() }); return(Ok(result)); }