Optimized getRepository