Refactor registration of events and their handlers to be done as part of dependency injection configuration.