templatize FactoryService