#41 Improve serialization code
#41 doc.version is hash of latest event