protected function after_restore() {
        global $DB;

        $contextid = $this->task->get_contextid();
        $instanceid = $this->task->get_activityid();
        $olditemid = $this->task->get_old_activityid();

        $DB->set_field('tag_instance', 'itemid', $instanceid, array('contextid' => $contextid, 'itemid' => $olditemid));
    }