code re-factored

cleaned up the code for create event controller.