Added ability to serialize with key for Document