internal void Clear(DetailConfiguration detailConfiguration)
        {
            m_containersRemoved = m_containersRemoved ?? new List <DependencyObject>();

            var key = CustomItemContainerGeneratorRecyclingPools.GetKey(detailConfiguration);

            var itemContainerPool = default(ItemContainerRecyclingPool);

            if (m_itemContainerPools.TryGetValue(key, out itemContainerPool))
            {
                m_itemContainerPools.Remove(key);

                this.ClearPool(itemContainerPool, m_containersRemoved, pool => pool.Clear());
            }

            var headerFooterItemContainerPool = default(HeaderFooterItemContainerRecyclingPool);

            if (m_headerFooterItemContainerPools.TryGetValue(key, out headerFooterItemContainerPool))
            {
                m_headerFooterItemContainerPools.Remove(key);

                this.ClearPool(headerFooterItemContainerPool, m_containersRemoved, pool => pool.Clear());
            }

            var groupHeaderFooterItemContainerPool = default(GroupHeaderFooterItemContainerRecyclingPool);

            if (m_groupHeaderFooterItemContainerPools.TryGetValue(key, out groupHeaderFooterItemContainerPool))
            {
                m_groupHeaderFooterItemContainerPools.Remove(key);

                this.ClearPool(groupHeaderFooterItemContainerPool, m_containersRemoved, pool => pool.Clear());
            }

            this.OnContainersRemoved();
        }
        private T GetPool <T>(Dictionary <object, T> pools, DetailConfiguration detailConfiguration, bool create) where T : class, new()
        {
            if (pools == null)
            {
                throw new ArgumentNullException("pools");
            }

            var key  = CustomItemContainerGeneratorRecyclingPools.GetKey(detailConfiguration);
            var pool = default(T);

            if (!pools.TryGetValue(key, out pool))
            {
                if (create)
                {
                    pool = new T();
                    pools.Add(key, pool);
                }
                else
                {
                    pool = null;
                }
            }

            return(pool);
        }