Refactor the domain event implementation.