refactoring in base rest client