move event creation logic in a classmethod