Add cohort updated event
Add cohort deleted event
Use the new events in library functions.

HACK HACK HACK - userid and contextid are not validated