protected static function delete_data_for_user_in_course_module(approved_contextlist $contextlist) {
        global $DB;

        foreach ($contextlist as $context) {
            if ($context instanceof \context_module) {
                // Delete course completion data for this context.
                \core_completion\privacy\provider::delete_completion($contextlist->get_user(), null, $context->instanceid);
            }
        }

    }