There are multiple ways; One of which would be to have the client send over the data before leaving, another would be to periodically save it if the data is different than what it was the last check, and the last way would be to save it when the data is changed, all simply sending over the data.