We could replace this try-except block with a call to `get_or_create`, also, you should probably remove the call to `update_enrollment` here.

I'm thinking something like this:

```
course_enrollment = CourseEnrollment.get_or_create(order.user, course_id)

# validate etc

# the following call will take no action if the record already has these values
course_enrollment.update_enrollment(mode=mode, is_active=True)
```