Move event creation logic to common handler.