public static function reset_tour($tourid, $context, $pageurl) {
        $params = self::validate_parameters(self::reset_tour_parameters(), [
                'tourid'    => $tourid,
                'context'   => $context,
                'pageurl'   => $pageurl,
            ]);

        $context = \context_helper::instance_by_id($params['context']);
        self::validate_context($context);

        $tour = tourinstance::instance($params['tourid']);
        $tour->request_user_reset();

        $result = [];

        if ($tourinstance = \tool_usertours\manager::get_matching_tours(new \moodle_url($params['pageurl']))) {
            if ($tour->get_id() === $tourinstance->get_id()) {
                $result['startTour'] = $tour->get_id();

                \tool_usertours\event\tour_reset::create([
                    'contextid' => $context->id,
                    'objectid'  => $params['tourid'],
                    'other'     => [
                        'pageurl'   => $params['pageurl'],
                    ],
                ])->trigger();

            }
        }

        return $result;
    }