private void buttonAdd_Click(object sender, EventArgs e)
        {
            Platform platform = null;
            int      index    = -1;

            updating = true;

            if (string.IsNullOrEmpty(textBoxPlatformName.Text.Trim()))
            {
                FormCustomMessage.ShowError("Can not save without a valid name.");
                return;
            }

            if (textBoxPlatformName.Enabled)
            {
                if (PlatformBusiness.Get(textBoxPlatformName.Text.Trim()) != null)
                {
                    FormCustomMessage.ShowError("A platform with this name already exists.");
                    return;
                }
            }

            if (!string.IsNullOrEmpty(textBoxDefaultRomPath.Text) && string.IsNullOrEmpty(textBoxDefaultRomExtensions.Text))
            {
                FormCustomMessage.ShowError("Default rom extensions must also be filled");
                return;
            }
            if (textBoxPlatformName.Enabled)
            {
                platform = new Platform();
            }
            else
            {
                DataGridViewRow row = dataGridView.SelectedRows[0];
                index    = row.Index;
                platform = (Platform)row.Tag;
                textBoxPlatformName.Enabled = true;
                buttonAdd.Text = "Add";
            }

            platform.Id                   = comboBoxPlatformsDB.SelectedValue.ToString();
            platform.Name                 = textBoxPlatformName.Text.Trim();
            platform.Color                = buttonColor.BackColor;
            platform.ShowInFilter         = checkBoxShowInFilters.Checked;
            platform.ShowInList           = checkBoxShowInLinksList.Checked;
            platform.DefaultRomPath       = textBoxDefaultRomPath.Text;
            platform.DefaultRomExtensions = textBoxDefaultRomExtensions.Text.Replace(".", "");
            platform.UseRetroarch         = checkBoxUseRetroarch.Checked;
            platform.DefaultEmulator      = defaultEmulator;
            platform.Arcade               = checkBoxArcade.Checked;
            platform.Console              = checkBoxConsole.Checked;
            platform.Handheld             = checkBoxHandheld.Checked;
            platform.CD                   = checkBoxCD.Checked;
            platform.Emulators            = emulators;
            platform.IconPath             = textBoxPlatformIcon.Text;

            PlatformBusiness.Set(platform);
            AddToGrid(platform, index);
            Updated  = true;
            updating = false;
            Clean();
        }