public void Validate(DataItem rootDataNode, Field rootSchemaNode)
        {
            try
            {
                this.RootDataNode   = rootDataNode;
                this.RootSchemaNode = rootSchemaNode;

                int i          = 1;
                var schemaNode = RootSchemaNode.ChildNodes[0];

                if (RootDataNode.Children == null)
                {
                    ErrorList.Add($"Expected XMLNode {RootDataNode.Name}/{schemaNode.Name} is missing Line:{RootDataNode.LineNo}");
                    var child = RootDataNode.AddChild(new DataItem(schemaNode.Name, schemaNode.Optionality, schemaNode.Type, schemaNode.DataType, ""));//123
                    child.Props    = new System.Collections.ObjectModel.ObservableCollection <DataProperty>();
                    child.Children = new System.Collections.ObjectModel.ObservableCollection <DataItem>();
                }

                foreach (var child in RootDataNode.Children)
                {
                    logger.Info($"Validating {RootDataNode.Name}/{child.Name}[{i}] Schema:{RootSchemaNode.Name}/{schemaNode.Name}");
                    ValidateInternal(child, schemaNode);
                    i++;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
        private bool ValidateInternal(DataItem dataNode, Field schemaNode)
        {
            bool     isValid      = true;
            Field    ff_current   = schemaNode;
            DataItem data_current = dataNode;

            if (!ff_current.Name.Equals(data_current.Name, StringComparison.OrdinalIgnoreCase))
            {
                ErrorList.Add($"Expected XMLNode {ff_current.Name} found {data_current.Name} Line:{dataNode.LineNo}");
                isValid = false;
            }

            //logger.Info($"Validating {data_current.Name} properties");

            foreach (var ff_prop in ff_current.GetProps())
            {
                var data_prop = data_current.Props.FirstOrDefault(x => x.Name.Equals(ff_prop.Name, StringComparison.OrdinalIgnoreCase));
                if (data_prop == null)
                {
                    ErrorList.Add($"Expected XMLNode {ff_current.Name}/{ff_prop.Name} is missing in {data_current.Name} Line:{data_current.LineNo}");
                    isValid = false;
                }
                else
                {
                    if (!DataTypeChecker.IsValid(ff_prop, data_prop.Value))
                    {
                        ErrorList.Add($"Expected XMLNode {ff_current.Name}/{ff_prop.Name} value type mismatch Type:{ff_prop.Type}[{data_prop.Value}] Line:{data_prop.LineNo}");
                    }
                }
            }



            foreach (var ff_child in ff_current.GetContainerChild())
            {
                // logger.Info($"Validating child {ff_child.Name}");

                try
                {
                    if (data_current.ChildCount == 0)
                    {
                        ErrorList.Add($"Expected XMLNode <{ff_child.Name}> is missing in <{data_current.Name}> Line:{data_current.LineNo}");
                        isValid = false;
                        var item = data_current.AddChild(new DataItem(ff_child.Name, ff_child.Optionality, ff_child.Type, ff_child.DataType, ""));
                        item.Props    = new System.Collections.ObjectModel.ObservableCollection <DataProperty>();
                        item.Children = new System.Collections.ObjectModel.ObservableCollection <DataItem>();

                        break;
                    }

lblCheckAgain:
                    var data_child = data_current.Children.FirstOrDefault(x => x.Name.Equals(ff_child.Name, StringComparison.OrdinalIgnoreCase));
                    if (data_child == null)
                    {
                        ErrorList.Add($"Expected XMLNode <{ff_child.Name}> is missing in <{data_current.Name}> Line:{data_current.LineNo}");
                        var item = data_current.AddChild(new DataItem(ff_child.Name, ff_child.Optionality, ff_child.Type, ff_child.DataType, ""));
                        item.IsDataNodeMissing = true;
                        item.Props             = new System.Collections.ObjectModel.ObservableCollection <DataProperty>();
                        item.Children          = new System.Collections.ObjectModel.ObservableCollection <DataItem>();

                        isValid = false;
                        goto lblCheckAgain;
                    }
                    else
                    {
                        if (ff_child.ChildNodes != null)
                        {
                            ValidateInternal(data_child, ff_child);
                        }
                    }
                }
                catch (Exception ex)
                {
                    ErrorList.Add($"Child Node <{ff_child.Name}> validation error <{data_current.Name}> Line:{data_current.LineNo} {ex.Message}");
                }
            }

            return(isValid);
        }