Whent removing a user from a course the works are deleted too see BT#7027
Minor - format code.