protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        string Email          = null;
        bool   EmailChanged   = false;
        string AdCompanyEmail = null;

        AdCompany company = null;

        if (IsNewMode)
        {
            Membership.UserCreateResults results = Membership.CreateAdCompany(txtEmail.Text, out company);
            switch (results)
            {
            default:
            case Membership.UserCreateResults.UnknownError:
                Master.MessageCenter.DisplayErrorMessage(SuppliersStrings.GetText(@"MessageCreateFailedUnknown"));
                return;

            case Membership.UserCreateResults.AlreadyExists:
                Master.MessageCenter.DisplayErrorMessage(SuppliersStrings.GetText(@"MessageCreateFailedAlreadyExists"));
                return;

            case Membership.UserCreateResults.InvalidEmailAddress:
                Master.MessageCenter.DisplayErrorMessage(SuppliersStrings.GetText(@"MessageCreateFailedEmailAddressInvalid"));
                return;

            case Membership.UserCreateResults.Success:
                break;
            }
            CompanyId           = company.CompanyId;
            company.CreatedDate = DateTime.Now;
            AdCompanyEmail      = company.Email;
        }
        else
        {
            company        = AdCompany.FetchByID(CompanyId);
            AdCompanyEmail = company.Email;
        }
        company.BusinessName = txtBusinessName.Text;
        company.ContactName  = txtContactName.Text;
        company.ContactPhone = txtContactPhone.Text;
        company.Phone        = txtPhone.Text;
        company.Description  = txtDescription.Text;
        company.Save();

        if (IsNewMode)
        {
            CompanyId = company.CompanyId;
        }

        if (company.Email != txtEmail.Text.Trim().NormalizeEmail())
        {
            if (AdCompany.FetchByEmail(txtEmail.Text.Trim().NormalizeEmail()) != null)
            {
                Master.MessageCenter.DisplayWarningMessage(AppUsersStrings.GetText(@"MessageEmailChangeFailed"));
            }
            else
            {
                company.Email = txtEmail.Text.Trim().NormalizeEmail();
                EmailChanged  = true;
            }
        }

        AdCompanyEmail = company.Email;
        company.Save();

        if (IsNewMode)
        {
            string successMessage = AdvertisementsStrings.GetText(@"MessageCompanyCreated");
            string url            = @"EditAdCompany.aspx?Email=" + AdCompanyEmail + "&CompanyId=" + company.CompanyId;
            url += @"&message-success=" + Server.UrlEncode(successMessage);
            Response.Redirect(url, true);
        }
        else
        {
            string successMessage = SuppliersStrings.GetText(@"MessageSupplierSaved");
            if (EmailChanged)
            {
                string url = @"EditAdCompany.aspx?message-success=" + Server.UrlEncode(successMessage) + "&CompanyId=" + company.CompanyId;
                if (CompanyId != company.CompanyId)
                {
                    url += @"&Email=" + AdCompanyEmail;
                }
                Response.Redirect(url, true);
            }
            else
            {
                Master.MessageCenter.DisplaySuccessMessage(successMessage);
                LoadView();
            }
        }
    }