saving changes to documents table