now writes to database when you save a course