public InventoryItem Insert(InventoryItem entity)
 {
     Debug.WriteLine("INSERTING inventoryItem into database");
     lock (_lockObject)
     {
         var nextID = InventoryItems.Max(c => c.ID) + 1;
         entity.ID = nextID;
         entity.IncrementVersionByOne();
         InventoryItems.Add(Mapper.Map(entity, new InventoryItem()));
         return entity;
     }
 }
 public InventoryItem Update(InventoryItem entity)
 {
     lock (_lockObject)
     {
         var existing = InventoryItems.First(c => c.ID == entity.ID && c.Version == entity.Version);
         entity.IncrementVersionByOne();
         Mapper.Map(entity, existing);
         return entity;
     }
 }