public function reset_step_sortorder() {
        global $DB;
        $steps = $DB->get_records('tool_usertours_steps', array('tourid' => $this->id), 'sortorder ASC', 'id');

        $index = 0;
        foreach ($steps as $step) {
            $DB->set_field('tool_usertours_steps', 'sortorder', $index, array('id' => $step->id));
            $index++;
        }

        // Notify of a change to the step configuration.
        // Note: Do not notify of a tour change here. This is only a step change for a tour.
        cache::notify_step_change($this->get_id());

        return $this;
    }