Move handling event registration logic into its own class out of controller.