Another stupid mistake has taken a lot of my time last week. I developed a small library to provide function(s) to move attachments from rich text fields to separate db (nsf or some other). This function was supposed to be part of bigger process, so saving of document being processed was meant to happen in other code. That is why I had not tested what doc.save() would do. My tests were just checking destination db for created records containing moved files.