/**
  * Interally used to delete or restore items, using the request data. Meant to be
  * flexible between question or question groups
  * @param EEM_Base $model
  * @param boolean $trash wehter to trash or restore
  */
 private function _trash_or_restore_items(EEM_Base $model, $trash = TRUE)
 {
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     $success = 1;
     //Checkboxes
     //echo "trash $trash";
     //var_dump($this->_req_data['checkbox']);die;
     if (isset($this->_req_data['checkbox'])) {
         if (isset($this->_req_data['checkbox']) && !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
             // if array has more than one element than success message should be plural
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
             // cycle thru bulk action checkboxes
             while (list($ID, $value) = each($this->_req_data['checkbox'])) {
                 if (!$model->delete_or_restore_by_ID($trash, absint($ID))) {
                     $success = 0;
                 }
             }
         } else {
             // grab single id and delete
             $ID = absint($this->_req_data['checkbox']);
             if (!$model->delete_or_restore_by_ID($trash, $ID)) {
                 $success = 0;
             }
         }
     } else {
         // delete via trash link
         // grab single id and delete
         $ID = absint($this->_req_data[$model->primary_key_name()]);
         if (!$model->delete_or_restore_by_ID($trash, $ID)) {
             $success = 0;
         }
     }
     $action = $model instanceof EEM_Question ? 'default' : 'question_groups';
     //strtolower( $model->item_name(2) );
     //echo "action :$action";
     //$action = 'questions' ? 'default' : $action;
     if ($trash) {
         $action_desc = 'trashed';
         $status = 'trash';
     } else {
         $action_desc = 'restored';
         $status = 'all';
     }
     $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status' => $status));
 }