refactor models Document and TemplateDocument