factored xocial code out of DocmergeService