Migration logic from SearchView to a controller, where it should be.