public function execute()
 {
     $id = waRequest::request('id', 0, 'int');
     $category = null;
     $ccm = new waContactCategoryModel();
     if ($id) {
         $category = $ccm->getById($id);
     }
     if (waRequest::post()) {
         if ($id && waRequest::post('delete')) {
             $ccm->delete($id);
             exit;
         }
         $name = waRequest::request('name');
         $icon = waRequest::request('icon');
         if ($id && $category) {
             $category['name'] = $name;
             $category['icon'] = $icon;
             $ccm->updateById($id, array('name' => $name, 'icon' => $icon));
         } else {
             $category = array('name' => $name, 'icon' => $icon, 'app_id' => 'shop');
             $id = $ccm->insert($category);
             $category['id'] = $id;
         }
         echo "<script>window.location.hash = '#/category/{$id}';\$.customers.reloadSidebar();</script>";
         exit;
     }
     if (!$category) {
         $category = array('id' => '', 'name' => '', 'icon' => '', 'app_id' => '');
     }
     $icons = self::getIcons();
     if (empty($category['icon'])) {
         $category['icon'] = reset($icons);
     }
     $this->view->assign('category', $category);
     $this->view->assign('icons', $icons);
 }