public IEnumerable <DeliveryViewModel> GetDeliveriesForUser(string username) { if (username == null) { throw new ArgumentNullException(nameof(username), "Recepient is null"); } var user = GetUser(username); if (user == null) { throw new InvalidOperationException("User cannot be found"); } return(_deliveryRepository.GetByUsername(user.Username).Select(d => d.ToDeliveryViewModel())); }