public function process_gradebook_grade_item(array $data, array $raw) {

        // here we use get_nextid() to get a nondecreasing sequence
        $data['sortorder'] = $this->converter->get_nextid();

        if ($data['itemtype'] === 'mod') {
            return $this->process_mod_grade_item($data, $raw);

        } else if (in_array($data['itemtype'], array('manual', 'course', 'category'))) {
            return $this->process_nonmod_grade_item($data, $raw);

        } else {
            $this->log('unsupported grade_item type', backup::LOG_ERROR, $data['itemtype']);
        }
    }