public static string ToConfig(IEnumerable<AbstractComponent> components, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("[");
            var comma = false;

            foreach (var component in components)
            {
                if (comma)
                {
                    sb.Append(",");
                }
                comma = true;

                if(componentPreRender != null)
                {
                    componentPreRender.Invoke(component, new ComponentAddedEventArgs(component));
                }
                sb.Append(component.ToConfig());
            }

            sb.Append("]");

            return sb.ToString();
        }
        public static string ToConfig(IEnumerable<AbstractComponent> components, Ext.Net.UserControlLoader.ComponentAddedEventHandler componentPreRender, bool registerResources)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("[");
            
            bool comma = false;

            foreach (AbstractComponent component in components)
            {
                if (comma)
                {
                    sb.Append(",");
                }
                comma = true;

                if(componentPreRender != null)
                {
                    componentPreRender.Invoke(component, new ComponentAddedEventArgs(component));
                }
                sb.Append(component.ToConfig());
            }

            sb.Append("]");

            if (registerResources)
            {
                return ComponentLoader.AttachResources(components, sb.ToString());
            }

            return sb.ToString();
        }