WatcherThread: move write document to a method