private void ButtonAddNewGroupClick(object sender, EventArgs e)
        {
            var g = new ComputerPartGroup {Name = "_Nowa grupa", Show = false};
            using (var dbContext = new ComputerSetDatabaseContext())
            {
                var lastSequence = dbContext.ComputerPartGroups.Max(x => x.Sequence);
                g.Sequence = ++lastSequence;

                dbContext.ComputerPartGroups.Add(g);
                dbContext.SaveChanges();
            }

            buttonAddNewGroup.Enabled = false;
            buttonAddNewPart.Enabled = false;
            buttonDeleteSelected.Enabled = false;
            treeViewGroupsAndParts.Nodes.Clear();
            InitializeTreeView();

            DiagMsg(string.Format("utworzono nową grupę."));
        }
        //private static bool ContainsNode(TreeNode node1, TreeNode node2)
        //{
        //    if (node2.Parent == null) return false;
        //    if (node2.Parent.Equals(node1)) return true;
        //    // If the parent node is not null or equal to the first node,
        //    // call the ContainsNode method recursively using the parent of
        //    // the second node.
        //    return ContainsNode(node1, node2.Parent);
        //}
        private void SetGroupControls(ComputerPartGroup g)
        {
            customTabControl.SelectTab(tabPageGroup);

            textBoxName.Text = g.Name;
            checkBoxGroupShow.Checked = g.Show;

            using (var dbContext = new ComputerSetDatabaseContext())
            {
                var computerPartGroups = dbContext.ComputerPartGroups.ToList();
                computerPartGroups.Insert(0, new ComputerPartGroup { Id = -1, Name = "..." });

                comboBoxGroupParents.DataSource = computerPartGroups;
                comboBoxGroupParents.DisplayMember = "Name";
                comboBoxGroupParents.ValueMember = "Id";
            }

            comboBoxGroupParents.SelectedValue = g.Parent == null ? -1 : g.Parent.Id;
        }