refactor repos, move logic to service