/**
  * Performs the deletion of a single or multiple questions or question groups.
  * @param EEM_Base $model
  * @return int number of items deleted permanenetly
  */
 private function _delete_items(EEM_Soft_Delete_Base $model)
 {
     $success = 0;
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     if (!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_permanently_by_ID(absint($ID))) {
                 $success = 0;
             }
         }
     } elseif (!empty($this->_req_data['QSG_ID'])) {
         $success = $model->delete_permanently_by_ID($this->_req_data['QSG_ID']);
     } elseif (!empty($this->_req_data['QST_ID'])) {
         $success = $model->delete_permanently_by_ID($this->_req_data['QST_ID']);
     } else {
         EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
     }
     return $success;
 }
 /**
  * Deletes the specified question (and its associated question options) or question group
  * @param int $id
  * @param EEM_Soft_Delete_Base $model
  * @return boolean
  */
 protected function _delete_item($id, $model)
 {
     if ($model instanceof EEM_Question) {
         EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
     }
     return $model->delete_permanently_by_ID(absint($id));
 }