Refactored repository factories