Course purchases refactoring