refactor repository model.