void ChangeLevel(short level)
        {
            boxEnchantments.ItemSelectionChanged -= BoxEnchantmentsItemSelectionChanged;
            editId.ValueChanged          -= EditIdValueChanged;
            boxName.SelectedIndexChanged -= BoxNameSelectedIndexChanged;
            editLevel.ValueChanged       -= EditLevelValueChanged;

            editLevel.Value = level;
            var enchantment = (Data.Enchantment)boxName.SelectedItem;

            if (level != 0)
            {
                if (!slot.Item.tag.Contains("tag"))
                {
                    slot.Item.tag.Add("tag", NbtTag.CreateCompound());
                }
                if (!slot.Item.tag["tag"].Contains("ench"))
                {
                    slot.Item.tag["tag"].Add("ench", NbtTag.CreateList(NbtTagType.Compound));
                }
                NbtTag tag = null;
                foreach (var ench in slot.Item.tag["tag"]["ench"])
                {
                    if ((short)ench["id"] == enchantment.id)
                    {
                        tag = ench; break;
                    }
                }
                if (tag == null)
                {
                    tag = NbtTag.CreateCompound(
                        "id", enchantment.id,
                        "lvl", level);
                    slot.Item.tag["tag"]["ench"].Add(tag);
                    var listItem = new ListViewItem(new string[] { enchantment.name, editLevel.Value.ToString() });
                    listItem.Tag = enchantment.id;
                    boxEnchantments.Items.Add(listItem);
                    listItem.Selected = true;
                    enchantments.Add(enchantment.id, Tuple.Create(tag, listItem));
                }
                else
                {
                    tag["lvl"].Value = level;
                    foreach (ListViewItem item in boxEnchantments.Items)
                    {
                        if ((short)item.Tag == enchantment.id)
                        {
                            item.SubItems[1].Text = editLevel.Value.ToString();
                        }
                    }
                }
            }
            else
            {
                NbtTag tag = null;
                foreach (var ench in slot.Item.tag["tag"]["ench"])
                {
                    if ((short)ench["id"] == enchantment.id)
                    {
                        tag = ench; break;
                    }
                }
                tag.Remove();
                foreach (ListViewItem item in boxEnchantments.Items)
                {
                    if ((short)item.Tag == enchantment.id)
                    {
                        item.Remove(); break;
                    }
                }
                if (slot.Item.tag["tag"]["ench"].Count == 0)
                {
                    slot.Item.tag["tag"]["ench"].Remove();
                }
                if (slot.Item.tag["tag"].Count == 0)
                {
                    slot.Item.tag["tag"].Remove();
                }
                enchantments.Remove(enchantment.id);
            }
            slot.CallChanged();

            boxEnchantments.ItemSelectionChanged += BoxEnchantmentsItemSelectionChanged;
            editId.ValueChanged          += EditIdValueChanged;
            boxName.SelectedIndexChanged += BoxNameSelectedIndexChanged;
            editLevel.ValueChanged       += EditLevelValueChanged;
        }