Use factory in repository throughout