private void buttonCreate_Click(object sender, EventArgs e) { short spellId = short.Parse(this.labelSpellId.Text); if (this.dataHandler.Spells.ContainsKey(spellId)) { MessageBox.Show("SpellId already exists in the database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var spell = new SpellData { Id = SpellData.GenerateId(spellId), SpellId = spellId, }; if (this.StoreSpell(spell)) { var node = this.treeViewSpells.Nodes.Add(spell.SpellId.ToString(), spell.Name); this.logger.LogFormat("New Spell Created. Id = {0} Name = {1}", spellId, spell.Name); this.ResetFields(); } }