private function _assignTagsAndReport($type, $recordIds, $baseTag)
 {
     if (count($recordIds) > 0) {
         if ($type == 'errors') {
             $this->result_data['errors_list'] = $recordIds;
             $recordIds = array_keys($recordIds);
         }
         $this->result_data[$type] = count($recordIds);
         $needBookmark = @$this->data['tag'] == 1;
         if ($needBookmark) {
             if ($type != 'processed') {
                 $baseTag = $baseTag . ' ' . $type;
             }
             $success = tagsAssign($this->system, $recordIds, null, $baseTag);
             if ($success) {
                 $this->result_data[$type . '_tag'] = $baseTag;
             } else {
                 $this->result_data[$type . '_tag_error'] = $this->system->getError();
             }
         }
     }
 }
         $res['recIDs'] = @$_REQUEST['recIDs'];
     }
     /*
     $res = tagGetByUser($system, false, $_REQUEST['UGrpID']);
     */
 } else {
     if ($action == "replace" && @$_REQUEST['UGrpID']) {
         $res = tagReplace($system, $_REQUEST['ids'], $_REQUEST['new_id'], @$_REQUEST['UGrpID']);
     } else {
         if ($action == "rating") {
             $res = bookmarkRating($system, @$_REQUEST['recIDs'], @$_REQUEST['rating'], @$_REQUEST['UGrpID']);
         } else {
             if ($action == "set") {
                 // assign/remove tags to records
                 if (@$_REQUEST['assign']) {
                     $res = tagsAssign($system, @$_REQUEST['recIDs'], @$_REQUEST['assign'], null, @$_REQUEST['UGrpID']);
                 } else {
                     $res = array();
                 }
                 if (!is_bool($res) && @$_REQUEST['remove']) {
                     $res2 = tagsRemove($system, @$_REQUEST['recIDs'], @$_REQUEST['remove'], null, @$_REQUEST['UGrpID']);
                     if (is_bool($res) && !$res) {
                         $res = false;
                     } else {
                         $res = array_merge($res, $res2);
                     }
                 }
             } else {
                 $system->addError(HEURIST_INVALID_REQUEST, "Type of request not defined or not allowed");
             }
         }