Implementing the repository pattern