private DeliveryEvent CreateNewEvent(DeliveryEventViewModel vm)
 {
     return new DeliveryEvent
     {
         DateTime = DateTime.UtcNow, // ignore vm DateTime, we are creating a new event
         OrderFulfillments = vm.OrderFulfillments.Select(f => new OrderFulfillment
         {
             Assets = f.Assets.Select(a =>
                 inventory.MergeAsset(a.Id, a.SerialNumber, a.Description)).ToList(),
             Order = shop.MergeOrder(f.OrderId, f.OrderSourceId, f.OrderCustomerSourceId),
         }).ToList(),
     };
 }
        public IHttpActionResult PostDeliveryEvent(DeliveryEventViewModel deliveryEvent)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var newEvent = CreateNewEvent(deliveryEvent);

            inventory.HandleEvent(newEvent);

            var newEventViewModel = CreateViewModel(newEvent);

            return CreatedAtRoute("GetDeliveryEvent", new { id = newEventViewModel.Id }, newEventViewModel);
        }