factored legacy repository into service
moved cache closer to database