How can I run a function when a course module is deleted in moodle?