Refactoring: merged common code in search controllers