Move course code generation logic to a separate method in the course model.