private static List <OrderItemViewModel> SerializeOrderItems(IEnumerable <SalesHistoryItem> orderItems)
 {
     return(orderItems
            .Select(item => new OrderItemViewModel
     {
         Id = item.Id,
         Quantity = item.Quantity,
         Product = ProductMapper.SerializeProductViewModel(item.Product)
     }).ToList());
 }
        public static SalesHistory SerializeInvoiceToOrder(InvoiceViewModel invoice)
        {
            var now = DateTime.UtcNow;
            var salesHistoryItems = invoice.OrderItems
                                    .Select(item => new SalesHistoryItem
            {
                Id       = item.Id,
                Quantity = item.Quantity,
                Product  = ProductMapper.SerializeProductViewModel(item.Product)
            }).ToList();

            return(new SalesHistory
            {
                SalesHistories = salesHistoryItems,
                CreatedOn = now,
                UpdatedOn = now
            });
        }