Factor out get_course method.