private XmlModel GetXmlModel()
        {
            if (CircleDiagramModel == null || !CircleDiagramModel.IsCorrect())
            {
                return(null);
            }
            var countLevels              = CircleDiagramModel.CountLevels;
            var mainBackgroundColor      = SerializeUtils.BrushToInt(CircleDiagramModel.MainBackground);
            var ringBackgroundColor      = SerializeUtils.BrushToInt(CircleDiagramModel.RingBackground);
            var intervalBackgroundColor  = SerializeUtils.BrushToInt(CircleDiagramModel.IntervalBackground);
            var nodeBorderColor          = SerializeUtils.ColorToInt(CircleDiagramModel.NodeBorder.Color);
            var nodeBorderThickness      = CircleDiagramModel.NodeBorder.Width;
            var ringBorderColor          = SerializeUtils.ColorToInt(CircleDiagramModel.RingBorder.Color);
            var ringBorderThickness      = CircleDiagramModel.RingBorder.Width;
            var relationshipPenColor     = SerializeUtils.ColorToInt(CircleDiagramModel.RelationshipPen.Color);
            var relationshipPenThickness = CircleDiagramModel.RelationshipPen.Width;
            var numerationColor          = SerializeUtils.BrushToInt(CircleDiagramModel.NumerationBrush);
            var numerationFont           = SerializeUtils.FontToString(CircleDiagramModel.NumerationFont);
            var numerationBeginNumber    = CircleDiagramModel.NumerationBeginNumber;
            var numerationIsInverted     = CircleDiagramModel.NumerationIsInverted;

            return(new XmlModel(countLevels, mainBackgroundColor, ringBackgroundColor,
                                intervalBackgroundColor, nodeBorderColor, nodeBorderThickness, ringBorderColor,
                                ringBorderThickness, relationshipPenColor, relationshipPenThickness,
                                numerationColor, numerationFont, numerationBeginNumber, numerationIsInverted,
                                CircleDiagramModel.Nodes.Select(GetXmlNode).ToList(),
                                CircleDiagramModel.Relationships.Select(GetXmlRelationship).ToList()));
        }
        private static XmlNode GetXmlNode(CircleDiagramNode node)
        {
            if (node == null)
            {
                return(null);
            }

            var name              = node.Name;
            var text              = node.Text;
            var startAngle        = node.StartAngle;
            var sweepAngle        = node.SweepAngle;
            var startCircleNumber = node.StartCircleNumber;
            var countCircles      = node.CountCircles;
            var backgroundColor   = SerializeUtils.BrushToInt(node.Background);
            var textColor         = SerializeUtils.BrushToInt(node.TextBrush);
            var textFont          = SerializeUtils.FontToString(node.TextFont);

            return(new XmlNode(name, text, startAngle, sweepAngle,
                               startCircleNumber, countCircles, backgroundColor, textColor, textFont));
        }