add SafeSaveDocument base class
Merge pull request #76 from dimagi/cz

add SafeSaveDocument base class