public async Task WriteChildren(ISessionWriter sessionWriter, JObject json, ObservableCollection <IDataStructure> children)
        {
            if (children == Children)
            {
                _progressStep = 1d / children.Count;
            }

            var childIx = 0;

            foreach (var child in children)
            {
                if (children == Children)
                {
                    SavingProgress += _progressStep * childIx++;
                }
                var root = new JObject();
                try
                {
                    if (child is ISaveable saveable)
                    {
                        try
                        {
                            if (!await saveable.WriteData(root, sessionWriter))
                            {
                                Debug.WriteLine($"Could not save {child.Name} (save failed)");
                                continue;
                            }
                        }
                        catch (ObjectDisposedException ex)
                        {
                            SavingErrors.Add(ex);
                            continue;
                        }
                    }
                    else
                    {
                        Debug.WriteLine($"Could not save {child.Name} ({child} not saveable)");
                        root["user"] = new JObject();
                        root["meta"] = new JObject
                        {
                            ["type"]    = "no.sintef.folder",
                            ["version"] = 1
                        };
                    }
                }
                catch (NotImplementedException)
                {
                    Debug.WriteLine($"Could not save {child.Name} (save not implemented)");
                    continue;
                }
                catch (Exception ex)
                {
                    SavingErrors.Add(ex);
                    continue;
                }

                if (child.Children.Any())
                {
                    sessionWriter.PushPathName(child.Name);
                    try
                    {
                        await WriteChildren(sessionWriter, root, child.Children);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine($"There was a problem saving the session {ex.Message}");
                        SavingErrors.Add(ex);
                    }

                    sessionWriter.PopPathName();
                }

                JObject user;
                if (!json.TryGetValue("user", out var currentUser))
                {
                    // No 'user' obj in json ... make a default and use it
                    user = new JObject();
                }

                if (currentUser is JObject o)
                {
                    // Found 'user' obj in json ... use it
                    user = o;
                }
                else
                {
                    // Found 'user' obj in json, but not a JObject ... make a default and use it
                    user = new JObject();
                }

                if (child.Name != null)
                {
                    // Store tree from child
                    user[child.Name] = root;
                }
                else
                {
                    // Merge tree
                    user.Merge(root);
                }

                // Update json
                json["user"] = user;
            }
        }