adding document to history