private void loadHierarchyFromFile(object sender, EventArgs e)
        {
            SubjectCache.Clear();
            Subjects.Clear();

            openHierarchyDialog.Filter = "Data Files (*.dat) |*.dat|All files(*.*) |*.*";
            if (openHierarchyDialog.ShowDialog() == DialogResult.OK && openHierarchyDialog.FileName != null)
            {
                IFormatter formatter = new BinaryFormatter();

                Subjects = BinaryFormatterHelper.Read <List <SubjectItem> >(openHierarchyDialog.FileName,
                                                                            Assembly.GetExecutingAssembly());

                ConstructCasheFromSubjects(Subjects);

                subjectsTreeView.BeginUpdate();
                foreach (var item in Subjects)
                {
                    if (item.ParentItem == null)
                    {
                        subjectsTreeView.Nodes.Add(item.Node);
                    }
                }
                subjectsTreeView.EndUpdate();
            }
        }
 private void saveHierarchy(object sender, EventArgs e)
 {
     saveHierarchyDialog.Filter = "Data Files (*.dat) |*.dat|All files(*.*) |*.*";
     if (saveHierarchyDialog.ShowDialog() == DialogResult.OK && saveHierarchyDialog.FileName != null)
     {
         BinaryFormatterHelper.Write(Subjects, saveHierarchyDialog.FileName);
     }
 }