Refactor emit action into its own method