public static GUIControl Create(int dwParentId, XmlNode pControlNode, IDictionary <string, string> defines,
                                        string filename)
        {
            Type typeOfControlToCreate = GetControlType(pControlNode);

            if (typeOfControlToCreate == null)
            {
                return(null);
            }

            object[]   ctorParams = { dwParentId };
            GUIControl control    = (GUIControl)
                                    Activator.CreateInstance(typeOfControlToCreate, ctorParams);

            try
            {
                //				if(control is ISupportInitialize)
                ((ISupportInitialize)control).BeginInit();

                XmlNode referenceNode =
                    (XmlNode)m_referenceNodesByControlType[typeOfControlToCreate];

                if (referenceNode != null)
                {
                    UpdateControlWithXmlData(control, typeOfControlToCreate, referenceNode, defines, filename);
                }

                XmlAttribute styleAttribute = pControlNode.Attributes["Style"];

                if (styleAttribute != null)
                {
                    XmlNode styleNode = _cachedStyleNodes[styleAttribute.Value];

                    if (styleNode != null)
                    {
                        UpdateControlWithXmlData(control, typeOfControlToCreate, styleNode, defines, filename);
                    }
                }

                UpdateControlWithXmlData(control, typeOfControlToCreate, pControlNode, defines, filename);

                control.ScaleToScreenResolution();
                AddSubitemsToControl(pControlNode, control);
                control.FinalizeConstruction();

                if (control is IAddChild)
                {
                    foreach (XmlNode subControlNode in pControlNode.SelectNodes("control"))
                    {
                        ((IAddChild)control).AddChild(Create(dwParentId, subControlNode, defines, filename));
                    }
                }

                if (typeOfControlToCreate == typeof(GUIFacadeControl))
                {
                    GUIFacadeControl facade   = (GUIFacadeControl)control;
                    XmlNodeList      nodeList = pControlNode.SelectNodes("control");
                    foreach (XmlNode subControlNode in nodeList)
                    {
                        GUIControl subControl = Create(dwParentId, subControlNode, defines, filename);

                        if (subControl is GUIPlayListItemListControl)
                        {
                            GUIPlayListItemListControl list = subControl as GUIPlayListItemListControl;
                            facade.PlayListLayout = list;
                        }

                        else if (subControl is GUIListControl)
                        {
                            GUIListControl list = subControl as GUIListControl;
                            if (list.SubType == "album")
                            {
                                facade.AlbumListLayout = list;
                            }
                            else
                            {
                                facade.ListLayout = list;
                            }
                        }
                        if (subControl is GUIThumbnailPanel)
                        {
                            facade.ThumbnailLayout = subControl as GUIThumbnailPanel;
                        }
                        if (subControl is GUIFilmstripControl)
                        {
                            facade.FilmstripLayout = subControl as GUIFilmstripControl;
                        }
                        if (subControl is GUICoverFlow)
                        {
                            facade.CoverFlowLayout = subControl as GUICoverFlow;
                        }
                        //UpdateControlWithXmlData(subControl, subControl.GetType(), subControlNode, defines);
                    }
                }

                //				if(control is ISupportInitialize)
                ((ISupportInitialize)control).EndInit();
            }
            catch (Exception e)
            {
                Log.Info("GUIControlFactory.Create: {0}\r\n\r\n{1}\r\n\r\n", e.Message, e.StackTrace);
                Log.Info("Parent: {0} Id: {1}", dwParentId, control.GetID);
            }

            return(control);
        }