public IEnumerable <DOMModel> GetPatches()
        {
            var newModels = patches.Select(p =>
            {
                if (p is DOMMarkerModel markerModel)
                {
                    var m = new DOMMarkerModel(markerModel.Id, markerModel.SequenceNumber, markerModel.ParentId, markerModel.Tag);
                    //foreach (var att in markerModel.Attributes)
                    //{
                    //    m.Attributes.Add(att.Key, att.Value);
                    //}
                    return(m);
                }
                else if (p is DOMElementModel elementModel)
                {
                    var m = new DOMElementModel(elementModel.Id, elementModel.SequenceNumber, elementModel.ParentId, elementModel.Tag);
                    foreach (var att in elementModel.Attributes)
                    {
                        m.Attributes.Add(att.Key, att.Value);
                    }
                    return(m);
                }
                return(p);
            }).ToArray();

            patches.Clear();
            return(newModels);
        }
        public int CreateMarkerElement(int parentId, int elementSequence, string label)
        {
            int id = markerRegionId;// + parentId + elementSequence + 1;

            markerRegionId += 1024;
            var dom = new DOMMarkerModel(id, elementSequence, parentId, label);

            if (parentId < 0)
            {
                rootDOM.Children[id] = dom;
            }
            else
            {
                (doms[parentId] as DOMElementModel).Children[id] = dom;
            }
            doms[id] = dom;
            if (!patches.Contains(dom))
            {
                patches.Add(dom);
            }
            return(id);
        }