Added abstraction layer for document serialization