$ 0 0 by Omar Esgaib. You can check API functions "core_user_create_users", "core_course_create_courses", "enrol_manual_enrol_users" maybe they do the job you need.