Generalize repository functions