Fixing certain bugs that arose due to refactorings couple of days back.

1) save doc into history before updating the current doc.
2) Fixing deserialization issue with the special type;
DenormalizedReference.