Creating a data repository with generics and protocols