/**
  * @Route("create")
  * @param @params
  */
 public function createCategory(CategoryBindingModel $category)
 {
     if ($_SESSION['role_id'] !== '3') {
         http_response_code(400);
         ob_end_clean();
         echo "You are not authenticated to add this category";
         die;
     }
     if (!$category->modelState()->isValid()) {
         http_response_code(400);
         ob_end_clean();
         var_dump($category->modelState()->get());
         die;
     }
     $name = $category->getName();
     $oldCategory = $this->_categoriesRepo->findByName($name);
     if (!is_null($oldCategory)) {
         http_response_code(400);
         ob_end_clean();
         echo "Category: {$name} already exists";
         die;
     }
     $this->_categoriesRepo->create($category);
 }
 public function create(CategoryBindingModel $category)
 {
     // Insert or update the $category
     // in the 'categories' table
     $this->db->insertEntity('categories', array('name' => $category->getName(), 'description' => $category->getDescription(), 'is_deleted' => false));
 }