Fix that removed values/namespaces remain in the session storage

fixes #5934
Make it possible to save the session by its associated session namespaces