// POST /api/categories
 public HttpResponseMessage Post(CategoryModel category)
 {
     if (ModelState.IsValid)
     {
         var command = new CreateOrUpdateCategoryCommand(category.CategoryId, category.CategoryName, category.Description);
         var result  = commandBus.Submit(command);
         if (result.Success)
         {
             var categoryWithExpense = new CategoryWithExpense {
                 CategoryName = category.CategoryName, Description = category.Description, TotalExpenses = 0
             };
             var    response = Request.CreateResponse <CategoryModel>(HttpStatusCode.Created, category);
             string uri      = Url.Route(null, new { id = category.CategoryId });
             response.Headers.Location = new Uri(Request.RequestUri, uri);
             return(response);
         }
     }
     else
     {
         var errors = new Dictionary <string, IEnumerable <string> >();
         foreach (var keyValue in ModelState)
         {
             errors[keyValue.Key] = keyValue.Value.Errors.Select(e => e.ErrorMessage);
         }
         return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
     }
     throw new HttpResponseException(HttpStatusCode.BadRequest);
 }
 // POST /api/categories
 public HttpResponseMessage<CategoryWithExpense> Post(CategoryModel category)
 {
                                 
         if (ModelState.IsValid)
         {
             var command = new CreateOrUpdateCategoryCommand(category.CategoryId, category.CategoryName, category.Description);   
             var result = commandBus.Submit(command);
             if (result.Success)
             {
                 var categoryWithExpense = new CategoryWithExpense { CategoryName = category.CategoryName, Description = category.Description, TotalExpenses = 0 };
                 var response = new HttpResponseMessage<CategoryWithExpense>(categoryWithExpense, HttpStatusCode.Created);
                 string uri = Url.Route(null, new { id = category.CategoryId });
                 response.Headers.Location = new Uri(Request.RequestUri, uri);
                 return response;
             }
         }    
      throw new HttpResponseException(HttpStatusCode.BadRequest);
 }
 // POST /api/categories
 public HttpResponseMessage <CategoryWithExpense> Post(CategoryModel category)
 {
     if (ModelState.IsValid)
     {
         var command = new CreateOrUpdateCategoryCommand(category.CategoryId, category.CategoryName, category.Description);
         var result  = commandBus.Submit(command);
         if (result.Success)
         {
             var categoryWithExpense = new CategoryWithExpense {
                 CategoryName = category.CategoryName, Description = category.Description, TotalExpenses = 0
             };
             var    response = new HttpResponseMessage <CategoryWithExpense>(categoryWithExpense, HttpStatusCode.Created);
             string uri      = Url.Route(null, new { id = category.CategoryId });
             response.Headers.Location = new Uri(Request.RequestUri, uri);
             return(response);
         }
     }
     throw new HttpResponseException(HttpStatusCode.BadRequest);
 }