private void Save()
    {
        // Retrieve the new text in the templated columns

        // Prepare the command text
        bool newItem = false;

        Organization organization = null;

        if (orgId == -1)
        {
            organization = new Organization(orgId, txtOrgCode.Text, txtOrgName.Text, txtDescription.Text, txtOrgType.Text);
            newItem      = true;
        }
        else
        {
            organization = Organization.GetByKey(orgId);
            if (organization != null)
            {
                organization.Code        = txtOrgCode.Text;
                organization.Name        = txtOrgName.Text;
                organization.Type        = txtOrgType.Text;
                organization.Description = txtDescription.Text;
            }
        }

        if (organization.Save())
        {
            SessionState.ClearAppOrganizations();
            if (newItem)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
            }
            else
            {
                lbError.CssClass = "hc_success";
                lbError.Text     = "Data saved!";
                lbError.Visible  = true;
            }
        }
        else
        {
            lbError.CssClass = "hc_error";
            lbError.Text     = Organization.LastError;
            lbError.Visible  = true;
        }
    }
    private void Delete()
    {
        Organization organization = Organization.GetByKey(orgId);

        if (organization != null)
        {
            if (organization.Delete(HyperCatalog.Shared.SessionState.User.Id))
            {
                SessionState.ClearAppOrganizations();
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", "<script>back();</script>");
            }
            else
            {
                lbError.CssClass = "hc_error";
                lbError.Text     = Organization.LastError;
                lbError.Visible  = true;
            }
        }
    }