protected static function export_user_session_data(int $userid, \context $context) {
        global $DB, $SESSION;

        $records = $DB->get_records('sessions', ['userid' => $userid]);
        if (!empty($records)) {
            $sessiondata = (object) array_map(function($record) {
                return [
                    'state' => $record->state,
                    'sessdata' => base64_decode($record->sessdata),
                    'timecreated' => transform::datetime($record->timecreated),
                    'timemodified' => transform::datetime($record->timemodified),
                    'firstip' => $record->firstip,
                    'lastip' => $record->lastip
                ];
            }, $records);
            writer::with_context($context)->export_data([get_string('privacy:sessionpath', 'user')], $sessiondata);
        }
    }