public void Dispose()
 {
     RootNode.Dispose();
     NodesCounter = 0;
     PqNodeSelector.Clear();
     PqNodeSelector = null;
     NodesFrequency.Clear();
     NodesFrequency = null;
     TreeNodes.Clear();
     TreeNodes = null;
     TreePaths.Clear();
     TreePaths = null;
 }
        private void DropSupNode(SupNode supNode, ShopCatNode parentShopCatNode, TreeNodes targetCollection)
        {
            List<ShopCategory> newShopCategories = supNode.Base.CreateShopCategories(parentShopCatNode.Base);

            context.SaveChanges();

            targetCollection.Clear();
            foreach (var newShopCategory in newShopCategories)
            {
                var newShopCatNode = new ShopCatNode(newShopCategory, parentShopCatNode);
                targetCollection.Add(newShopCatNode);
            }
        }