public void PostCategory(IdNameFor<Category> model)
 {
     if(model.Id== null)
     {
         this.categoryService.RegisterCategory(new Category() { Name = model.Name, State = Domain.Enums.CategoryState.Published });
         this.categoryService.SaveChanges();
     }
     else
     {
         var c = this.categoryService.GetById(new Guid(model.Id));
         c.Name = model.Name;
         this.categoryService.SaveChanges();
     }
 }
 public IHttpActionResult CreateLibrary(IdNameFor<LibraryIdNameModel> nameValue)
 {
     var user = this.User.Identity.Name;
     if(nameValue.Id == null) {
     this.libraryService.Create(nameValue.Name, user);
     }
     else
     {
         var lib = this.libraryService.GetById(new Guid(nameValue.Id));
         lib.Name = nameValue.Name;
         this.libraryService.SaveChanges();
     }
     return Ok();
 }
 public void PostCategory(Guid id , IdNameFor<Category> model)
 {
     model.Id = id.ToString();
     PostCategory(model);
 }
 public IHttpActionResult Edit(Guid id, IdNameFor<LibraryIdNameModel> nameValue)
 {
     this.CreateLibrary(nameValue);
     return Ok();
 }