@itsjeyd nit: I would suggest extracting this into a method here or in dedicated module; when we get to course discussions (aka DiscussionCourseXBlock) we'll likely need to do something quite similar. 