/**
  * Delete category
  *
  * @param       int  $category_id
  * @return      bool
  */
 function delete_category($category_id)
 {
     $this->db->trans_begin();
     $data = array('id' => $category_id);
     $this->db->delete('categories', $data);
     $query = $this->db->get_where('dishes', array('category_id' => $category_id));
     $have_dish_belong_to_this_category = $query->num_rows();
     if ($have_dish_belong_to_this_category > 0) {
         $dishes_id_belong_to_category = array();
         // Get all dishes id belongs to category
         foreach ($query->result() as $dish) {
             $dishes_id_belong_to_category[] = $dish->id;
         }
         // Delete list of dishes belongs to category
         $this->load->model('dishes_model');
         if (Dishes_model::delete_dishes($dishes_id_belong_to_category)) {
             $this->load->model('menus_model');
             // Delete list of dishes in menus have this category
             Menus_model::delete_dishes_in_menu_by_field('dish_id', $dishes_id_belong_to_category);
         }
     }
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return FALSE;
     } else {
         $this->db->cache_delete('admin', 'dishes');
         $this->db->trans_commit();
         return TRUE;
     }
 }