refactor Repo and Model in external lib