Code to add an event