private List <Column> ParseLayoutXml(EntityQuery rootEntity, string layoutXml)
        {
            jQueryObject  layout  = jQuery.FromHtml(layoutXml);
            jQueryObject  cells   = layout.Find("cell");
            List <Column> columns = new List <Column>();

            cells.Each(delegate(int index, Element element)
            {
                string cellName    = element.GetAttribute("name").ToString();
                string logicalName = cellName;
                EntityQuery entity;
                AttributeQuery attribute;

                // Is this an alias attribute?
                int pos = cellName.IndexOf('.');
                if (pos > -1)
                {
                    // Aliased entity
                    string alias = cellName.Substr(0, pos);
                    logicalName  = cellName.Substr(pos + 1);
                    entity       = AliasEntityLookup[alias];
                }
                else
                {
                    // Root entity
                    entity = rootEntity;
                }

                // Does the attribute allready exist?
                if (entity.Attributes.ContainsKey(logicalName))
                {
                    // Already exists
                    attribute = entity.Attributes[logicalName];
                }
                else
                {
                    // New
                    attribute             = new AttributeQuery();
                    attribute.Columns     = new List <Column>();
                    attribute.LogicalName = logicalName;
                    entity.Attributes[attribute.LogicalName] = attribute;
                }

                // Add column
                object widthAttribute = element.GetAttribute("width");
                if (widthAttribute != null)
                {
                    int width             = int.Parse(element.GetAttribute("width").ToString());
                    object disableSorting = element.GetAttribute("disableSorting");
                    Column col            = GridDataViewBinder.NewColumn(attribute.LogicalName, attribute.LogicalName, width); // Display name get's queried later
                    col.Sortable          = !(disableSorting != null && disableSorting.ToString() == "1");
                    attribute.Columns.Add(col);
                    columns.Add(col);
                }
            });

            return(columns);
        }