Add code that will actually save the Document object into the database

The code by @saurabhrpi did not save the documents upon transfer.  I have added in that code.