Repository pattern with generic support.