I know that you're copying the pattern used in the courseware views, but if we're doing this in two different places, I think we should refactor this logic out to better specify what it's doing.