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

        $plan = $controller->get_plan();

        // Add the course task, responsible for outputting
        // all the course related information
        $plan->add_task(backup_factory::get_backup_course_task($controller->get_format(), $id));

        // For the given course, add as many section tasks as necessary
        $sections = backup_plan_dbops::get_sections_from_courseid($id);
        foreach ($sections as $section) {
            self::build_section_plan($controller, $section);
        }

        // For the given course, add as many block tasks as necessary
        $blockids = backup_plan_dbops::get_blockids_from_courseid($id);
        foreach ($blockids as $blockid) {
            $plan->add_task(backup_factory::get_backup_block_task($controller->get_format(), $blockid));
        }
    }