Save only when document has changed