public Ingredient Add(Ingredient item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     //item.Id = _nextId++;
     ingredients.Add(item);
     return item;
 }
 // provavelmente estará errado.
 public bool Update(Ingredient item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     ingredients.Find(p => p.Name == item.Name);
     ingredients.RemoveAll(p => p.Name == item.Name);
     ingredients.Add(item);
     return true;
 }
        // PUT odata/Ingredients(5)
        public IHttpActionResult Put([FromODataUri] string key, Ingredient ingredient)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (key != ingredient.Name)
            {
                return BadRequest();
            }

            db.Entry(ingredient).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IngredientExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(ingredient);
        }
        // POST odata/Ingredients
        public IHttpActionResult Post(Ingredient ingredient)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Ingredients.Add(ingredient);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (IngredientExists(ingredient.Name))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return Created(ingredient);
        }