public static List <Item> GetBreadcrumbTrail(this Item item)
        {
            List <Item> items = new List <Item>();
            var         sc    = SiteExtensions.GetContextSite();

            if (sc != null)
            {
                var startItem = Sitecore.Context.Database.GetItem(sc.StartPath);
                if (startItem != null)
                {
                    Item currentItem = item;
                    items.Add(currentItem);
                    while (!currentItem.ID.Equals(startItem.ID))
                    {
                        currentItem = currentItem.Parent;
                        if (currentItem == null)
                        {
                            return(new List <Item>());
                        }

                        items.Insert(0, currentItem);
                    }
                }
            }

            return(items);
        }
        private void ProccessItem(Item item)
        {
            var db = Sitecore.Context.Database ?? Sitecore.Data.Database.GetDatabase("master");

            if (Sitecore.Diagnostics.Log.IsDebugEnabled)
            {
                if (item != null && item.Fields != null)
                {
                    StringBuilder sb = new StringBuilder();

                    for (int i = 0; i < item.Fields.Count; i++)
                    {
                        sb.Append(string.Format("Item name: {0}, Field name: {1}, Field key: {2}, Field ID: {3}\n", item.Name, item.Fields[i].Name, item.Fields[i].Key, item.Fields[i].ID.Guid.ToString()));
                    }

                    if (sb.Length > 0)
                    {
                        Sitecore.Diagnostics.Log.Debug("Item fields\n" + sb.ToString(), this);
                    }
                }
            }

            ConfigItem = item;

            if (item != null)
            {
                this.SiteId = item.ID.Guid;
            }

            //Override Config Item if Site has it set as a context property
            var    contextSite  = SiteExtensions.GetContextSite();
            string configRootId = contextSite.Properties[SiteConfigRootKey];

            if (!string.IsNullOrWhiteSpace(configRootId))
            {
                var configRoot = db.GetItem(new ID(configRootId));
                if (configRoot != null)
                {
                    ConfigItem = configRoot;
                }
            }
        }