public static function inactivate($policyid) {
        global $DB;

        if ($currentversionid = $DB->get_field('tool_policy', 'currentversionid', ['id' => $policyid])) {
            // Archive the current version.
            $DB->set_field('tool_policy_versions', 'archived', 1, ['id' => $currentversionid]);
            // Unset current version for the policy.
            $DB->set_field('tool_policy', 'currentversionid', null, ['id' => $policyid]);
        }
    }