add edit and create event logic