document construction and persistence