Add factory for returning repositories