protected static function get_and_export_user_preference(int $userid, string $userpreference, $transform = false) {
        $prefvalue = get_user_preferences($userpreference, null, $userid);
        if ($prefvalue !== null) {
            if ($transform) {
                $transformedvalue = transform::yesno($prefvalue);
            } else {
                $transformedvalue = $prefvalue;
            }
            writer::export_user_preference(
                'scormreport_basic',
                $userpreference,
                $transformedvalue,
                get_string('privacy:metadata:preference:'.$userpreference, 'scormreport_basic')
            );
        }
    }