sample code of event manager