refactoring of the GetSearchResult method