wrap updates/inserts in transaction