private void categoriesList_DoubleClick(object sender, System.EventArgs e)
        {
            Category cat          = (Category)categoriesList.SelectedItem;
            string   originalName = cat.Name;

            if (cat != null)
            {
                AccessPolicy[] policies = new AccessPolicy[policiesList.Items.Count];
                policiesList.Items.CopyTo(policies, 0);
                AddCategoryForm form = new AddCategoryForm(policies);

                form.SetModify(cat.Name, (AccessPolicy)policyTable[cat.PolicyID]);

                DialogResult result = form.ShowDialog(this);
                if (result != DialogResult.Cancel)
                {
                    cat.Name     = form.CategoryName;
                    cat.PolicyID = form.SelectedPolicy.Id;

                    bool success = categoryDAO.UpdateCategory(originalName, cat.Name, cat.PolicyID);
                    if (success)
                    {
                        RefreshCategoryList();
                    }
                    else
                    {
                        Error("Could not update category.");
                    }
                }
            }
        }
        private void newCategoryButton_Click(object sender, System.EventArgs e)
        {
            AccessPolicy[] policies = new AccessPolicy[policiesList.Items.Count];
            policiesList.Items.CopyTo(policies, 0);

            AddCategoryForm form = new AddCategoryForm(policies);


            DialogResult result = form.ShowDialog(this);

            if (result != DialogResult.Cancel)
            {
                Category cat = new Category();
                cat.Name     = form.CategoryName;
                cat.PolicyID = form.SelectedPolicy.Id;

                bool success = categoryDAO.AddCategory(cat);
                if (success)
                {
                    categoriesList.Items.Add(cat);
                }
                else
                {
                    Error("Could not create new category.");
                }
            }
        }