Added a factory method for creating domain events.