private void DeleteSelectedNode(TreeNode node = null)
        {
            TreeView tvObject     = treeObjects.Visible ? treeObjects : tvSearchResult;
            TreeNode nodeToDelete = node ?? tvObject.SelectedNode;

            if (nodeToDelete == null)
            {
                return;
            }

            TreeNode parentNode = nodeToDelete.Parent;

            TestObjectNurse nurseObject = TestObjectNurse.FromTreeNode(nodeToDelete);

            nurseObject.Remove();
            if (tvObject == tvSearchResult)
            {
                nodeToDelete.Remove();
            }
            if (parentNode == null)
            {
                if (tvObject.Nodes.Count > 0)
                {
                    tvObject.SelectedNode = tvObject.TopNode;
                }
            }
            else
            {
                tvObject.SelectedNode = parentNode;
            }
            SelectedNodesChanged(tvObject.SelectedNode);
            AppEnvironment.SetModelChanged(true);
        }
        public void ModelFileHandler_SaveToModelFile()
        {
            TreeView treeView = new TreeView();

            TestObjectNurse rootNurse = TestObjectNurse.FromTree(treeView);

            AppModel model = ModelFileHandler.LoadModelFile("UnitTestObjectModel1.json", rootNurse);


            TestObjectNurse nurseNode = (TestObjectNurse)rootNurse.FindRecursive(DescriptorKeys.NodeName, "Test Explorer");

            string imageFilePath = AppEnvironment.GetModelResourceFilePath("TestObjectNurseTest.png");

            CacheHandler.EnsureFileDirectoryExists(imageFilePath);

            Snapshot.CaptureImageToFile(new Rectangle(0, 0, 100, 200), imageFilePath);

            Assert.IsTrue(File.Exists(imageFilePath));

            nurseNode.ImageFile = "TestObjectNurseTest.png";

            //remove from root
            nurseNode.Remove();

            AppEnvironment.DumpRecyclingBin(rootNurse);
        }