/// <summary>
 /// Maps a collection of SalesOrderItems to SalesOrderItemModels
 /// </summary>
 /// <param name="orderItems"></param>
 /// <returns></returns>
 public static List <SalesOrderItemModel> SerialiseSalesOrderItems(IEnumerable <SalesOrderItem> orderItems)
 {
     return(orderItems.Select(item => new SalesOrderItemModel
     {
         Id = item.Id,
         Quantity = item.Quantity,
         Product = ProductMapper.SerialiseProductModel(item.Product)
     }).ToList());
 }
        /// <summary>
        /// Maps an InvoiceModel to a salesorder data model
        /// </summary>
        /// <param name="invoice"></param>
        /// <returns></returns>
        public static SalesOrder SerialiseInvoiceToOrder(InvoiceModel invoice)
        {
            var salesOrderItems = invoice.LineItems
                                  .Select(item => new SalesOrderItem
            {
                Id       = item.Id,
                Quantity = item.Quantity,
                Product  = ProductMapper.SerialiseProductModel(item.Product)
            })
                                  .ToList();

            return(new SalesOrder
            {
                SalesOrderItems = salesOrderItems,
                UpdatedOn = DateTime.UtcNow,
                CreatedOn = DateTime.UtcNow
            });
        }