public IHttpActionResult PostCleaningEvent(CleaningEventViewModel cleaningEvent)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var newEvent = CreateNewEvent(cleaningEvent);

            inventory.HandleEvent(newEvent);

            var newEventViewModel = CreateViewModel(newEvent);

            return CreatedAtRoute("GetCleaningEvent", new { id = newEventViewModel.Id }, newEventViewModel);
        }
 private CleaningEvent CreateNewEvent(CleaningEventViewModel vm)
 {
     return new CleaningEvent
     {
         DateTime = DateTime.UtcNow, // dont copy from vm - we are creating a new event
         Assets = vm.Assets.Select(a =>
             inventory.MergeAsset(a.Id, a.SerialNumber, a.Description)).ToList(),
     };
 }