public static bool ApplyChange(BlockNode block, ControlPath path, string property, FunctionNode func, bool wasRemoved)
            {
                var visitor = new ChangeComponentFunctionVisitor(property, func, wasRemoved);

                visitor.Visit(block, path);
                return(visitor._success);
            }
        public void Apply(CanvasDocument document)
        {
            var topParentName = ControlPath.Current;

            if (document._screens.TryGetValue(topParentName, out var blockNode))
            {
                if (!ChangeComponentFunctionVisitor.ApplyChange(blockNode, ControlPath.Next(), PropertyName, _func, _wasRemoved))
                {
                    return;
                }
            }

            if (document._components.TryGetValue(topParentName, out blockNode))
            {
                if (!ChangeComponentFunctionVisitor.ApplyChange(blockNode, ControlPath.Next(), PropertyName, _func, _wasRemoved))
                {
                    return;
                }

                if (document._templateStore.TryGetTemplate(topParentName, out var updatableTemplate))
                {
                    var customProps = updatableTemplate.CustomProperties.ToDictionary(prop => prop.Name);
                    if (_wasRemoved)
                    {
                        customProps.Remove(PropertyName);
                    }
                    else if (_customProperty != null)
                    {
                        customProps[PropertyName] = _customProperty;
                    }
                    else
                    {
                        return;
                    }
                    updatableTemplate.CustomProperties = customProps.Values.ToArray();
                }
            }
        }