Refactory management command to create master course

Move some reusable functions to separate module.
We’re going to create management command to update
quizblocks directly to courses. Later.
Management command to update course’s quizblocks directly.