Saving State of Grid

We have the following problem:
We want to save the grid state (order of columns, hidden columns, sort of columns, filtering) for the grids in our application for each user to the database. Our idea was to react to the detachment of the grid and use the grid state to get all relevant information. This information is stored in the database. After attachment of the grid, the information is loaded from the database and transfered to the current GridState of the grid.
We now have problems with the GridState. All relevant information (sorting, order, etc) in this Object is conntected to ColumnIds, which are numbers. These numbers change if the class we put in our BeanItemContainer changes (e.g. fields are added or removed). We therefore can’t save the ColumnIDs, we would rather use the PropertyIds. We couldn’t find a way though to map the ColumnIds to the PropertyIds and vice versa. The grid seems to be using a private Keymapper for this job, but it is not accessible from the outside.
Is there a way for us to map ColumnIds to PropertyIds?
Or has anyone a different idea, how to store settings of a grid without using the GridState?

Thank you for you help!

I would do this with different approach.

For example Grid has a method getColumns(), which returns set of Columns in their visual order. So in case you want to save that order to database, you can use that method to get the order you want to save and iterate the Columns in the set to get Column specific data (check methods of Column class which data you can get and set).