preserving the selected item in Vaadin 8 Grid after refreshing the data?

Is there a way to not lose the select highlight after you refresh grid? I’ve got a set of items in the list that are sorted by their own attribute called ordernumber. I’m trying to swap places of 2 items. The data updates and the places do swap with my method. But I lose the selection I’ve made once I call the grid.getDataProvider().refreshAll(); which is required to have the grid updated, so the items actually swap places. Basically, I’m looking for a way to store something, like, index of the item in the grid and then be able to select it programmatically after I’ve updated the grid. Anyone?