Refactor group repo related code