edit insert logic