Repository pattern restructure