public HttpResponseMessage Post(Tag item)
        {
            this.tagRepository.InsertOrUpdate(item);
            this.tagRepository.Save();

            var response = this.Request.CreateResponse(HttpStatusCode.Created, item);
            response.Headers.Location = this.Url.ApiLink(item.Id);
            return response;
        }
 public void InsertOrUpdate(Tag tag)
 {
     if (tag.Id == default(int))
     {
         // New entity
         context.Tags.Add(tag);
     }
     else
     {
         // Existing entity
         context.Entry(tag).State = EntityState.Modified;
     }
 }
 public Tag Put(int id, Tag item)
 {
     this.tagRepository.InsertOrUpdate(item);
     this.tagRepository.Save();
     return item;
 }