Moved save event code into closure, save evnts from edit dialog