Created a repository factory and am now passing this to the controllers and services.