Refactoring: Extract common function(exists function)