* [refactoring] move duplicated code in one method