I think this works, but perhaps it's better form to use a class function in CourseEnrollment?  Or if one doesn't exist that does what you want, create one?