public void Update(InventoryItem inventoryItem)
 {
     foreach (InventoryItem item in _db)
     {
         if (item.Id == inventoryItem.Id)
         {
             _db.Remove(item);
             _db.Add(inventoryItem);
             break;
         }
     }
 }
        // POST api/<controller>
        public IHttpActionResult Post(InventoryItem item)
        {
            if (ModelState.IsValid)
            {
                _inventoryRepository.Add(item);
                _inventoryRepository.SaveChanges();

                return Created<InventoryItem>(Request.RequestUri + item.Id.ToString(), item);
            }
            else
            {
                return BadRequest(ModelState);
            }
        }
 public void Add(InventoryItem inventoryItem)
 {
     _db.Add(inventoryItem);
 }
        // PUT api/<controller>/5
        public IHttpActionResult Put(int id, InventoryItem item)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            if (id != item.Id)
            {
                return BadRequest();
            }

            _inventoryRepository.Update(item);
            _inventoryRepository.SaveChanges();

            return Ok();
        }
 // TODO - Move to Service Layer
 private void NotifyOnDelete(InventoryItem item)
 {
     NotificationHub hub = new NotificationHub();
     hub.Send("USER", item.Label + " has been removed.");
 }