modified saveDoc() and deleteDoc() to use transactions