refactor Document model