protected function convert_autosaved_step_to_real_step() {
        if ($this->autosavedstep === null) {
            return;
        }

        $laststep = end($this->steps);
        if ($laststep !== $this->autosavedstep) {
            throw new coding_exception('Cannot convert autosaved step to real step, since other steps have been added.');
        }

        $this->observer->notify_step_modified($this->autosavedstep, $this, key($this->steps));
        $this->autosavedstep = null;
    }