static protected function build_course_plan($controller, $courseid) {

        $plan = $controller->get_plan();
        $info = $controller->get_info();

        // Add the course task, responsible for restoring
        // all the course related information
        $task = restore_factory::get_restore_course_task($info->course, $courseid);
        $plan->add_task($task);
        $controller->get_progress()->progress();

        // For the given course path, add as many block tasks as necessary
        // TODO: Add blocks, we need to introspect xml here
        $blocks = backup_general_helper::get_blocks_from_path($task->get_taskbasepath());
        foreach ($blocks as $basepath => $name) {
            if ($task = restore_factory::get_restore_block_task($name, $basepath)) {
                $plan->add_task($task);
                $controller->get_progress()->progress();
            } else {
                // TODO: Debug information about block not supported
            }
        }

        // For the given course, add as many section tasks as necessary
        foreach ($info->sections as $sectionid => $section) {
            self::build_section_plan($controller, $sectionid);
        }
    }