updating data model when changing tab