Refactoring manage document