private void MetroButtonSaveRole_Click(object sender, EventArgs e)
        {
            int    rolId    = Convert.ToInt32(metroLabelRoleId.Text);
            string roleName = MetroTextBoxRoleName.Text;

            //validate not to duplicate Roles
            if (!IsValidRole(roleName))
            {
                MetroMessageBox.Show(this, "Role with the name " + roleName + " already exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (roleName != "")
            {
                using (var context = new KucsaManagementDatabaseEntities())
                {
                    if (rolId == 0)
                    {
                        TblRole role = new TblRole
                        {
                            RoleName = roleName
                        };
                        context.TblRoles.Add(role);

                        try
                        {
                            context.SaveChanges();
                        }
                        catch (Exception es)
                        {
                            MetroMessageBox.Show(this, es.ToString(), "Entity Framework Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        MetroMessageBox.Show(this, roleName + " Role Added Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        var roleToUpdate = context.TblRoles.SingleOrDefault(role => role.RoleId == rolId);
                        if (roleToUpdate != null)
                        {
                            roleToUpdate.RoleName = roleName;
                        }
                        try
                        {
                            context.SaveChanges();
                        }
                        catch (Exception es)
                        {
                            MetroMessageBox.Show(this, es.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        MetroMessageBox.Show(this, roleName + " Updated Successfully!", "Successful Update", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }

                InitializeRoleList();
            }
        }
        private void MetroButtonDelete_Click(object sender, EventArgs e)
        {
            int deleteID = Convert.ToInt32(metroLabelRoleId.Text);

            if (metroLabelRoleId.Text != "0" && metroLabelRoleId.Text != null && isValidDelete(deleteID))
            {
                using (var context = new KucsaManagementDatabaseEntities())
                {
                    var delRole = new TblRole {
                        RoleId = deleteID
                    };
                    context.TblRoles.Attach(delRole);
                    context.TblRoles.Remove(delRole);
                    context.SaveChanges();
                    MetroMessageBox.Show(this, delRole.RoleName + " Removed Successfully from the system!", "Successful Removal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    InitializeRoleList();
                }
            }
        }