public static function form_policydoc_update_new(stdClass $form) {
        global $DB;

        if (empty($form->policyid)) {
            throw new coding_exception('Invalid policy document ID');
        }

        $form = clone($form);

        $form->id = $DB->insert_record('tool_policy_versions', (new policy_version(0, (object) [
            'timecreated' => time(),
            'policyid' => $form->policyid,
        ]))->to_record());

        return static::form_policydoc_update_overwrite($form);
    }