wrap delete/insert pairs in transaction