Convert instances of Document to object within render.

This issue seems to be further spread than just the reply page, so we
now check the data being passed into the render and convert it to
a plain object if it is an instance of Document