Generic getRepository method