// PUT /api/category/5
 public IHttpActionResult Put(int id, DepartmentModel department)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var entity = Mapper.Map<DepartmentModel, Department>(department);
             _departmentService.Update(entity);
             return Ok(department);
         }
         catch (Exception ex)
         {
             var responseMessage = Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message);
             return ResponseMessage(responseMessage);
         }
     }
     return BadRequest(ModelState);
 }
 // POST /api/category
 public IHttpActionResult Post(DepartmentModel department)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var entity = Mapper.Map<DepartmentModel, Department>(department);
             _departmentService.Insert(entity);
             var response = CreatedAtRoute("DefaultApi", new {id = department.Id}, department);
             return response;
         }
         catch (Exception ex)
         {
             var responseMessage = Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message);
             return ResponseMessage(responseMessage);
         }
     }
     return BadRequest(ModelState);
 }