private function upgrade_mod_assign() {
        global $DB, $CFG;

        // The current module must exist.
        $pluginmanager = core_plugin_manager::instance();

        $plugininfo = $pluginmanager->get_plugin_info('mod_assign');

        // Check that the assignment module is installed.
        if ($plugininfo && $plugininfo->is_installed_and_upgraded()) {
            // Include the required mod assign upgrade code.
            require_once($CFG->dirroot . '/mod/assign/upgradelib.php');
            require_once($CFG->dirroot . '/mod/assign/locallib.php');

            // Get the id and type of this assignment.
            $newinstance = $this->task->get_activityid();

            $record = $DB->get_record('assignment', array('id'=>$newinstance), 'assignmenttype', MUST_EXIST);
            $type = $record->assignmenttype;

            $subplugininfo = $pluginmanager->get_plugin_info('assignment_' . $type);

            // See if it is possible to upgrade.
            if (assign::can_upgrade_assignment($type, $subplugininfo->versiondb)) {
                $assignment_upgrader = new assign_upgrade_manager();
                $log = '';
                $success = $assignment_upgrader->upgrade_assignment($newinstance, $log);
                if (!$success) {
                    throw new restore_step_exception('mod_assign_upgrade_failed', $log);
                }
            }
        }
    }