protected function after_restore_lti() {
        global $DB;
        $activitytask = $this->task;
        $courseid = $activitytask->get_courseid();
        $gbstoupdate = $DB->get_records('ltiservice_gradebookservices', array('gradeitemid' => 0, 'courseid' => $courseid));
        foreach ($gbstoupdate as $gbs) {
            $oldgradeitemid = $this->get_mappingid('gbsgradeitemoldid', $gbs->id, 0);
            $newgradeitemid = $this->get_mappingid('grade_item', $oldgradeitemid, 0);
            if ($newgradeitemid > 0) {
                $gbs->gradeitemid = $newgradeitemid;
                $DB->update_record('ltiservice_gradebookservices', $gbs);
            }
        }
    }