refactor method and implement dbFactory on TokenCollector