/// <summary>
        /// Sets label of a specific category.
        /// </summary>
        /// <param name="id">Identifies the category.</param>
        /// <param name="label">The new category label.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// If <paramref name="id"/> is zero or a negative value.
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// If <paramref name="label"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// If <paramref name="label"/> is an empty string.
        /// </exception>
        /// <seealso cref="AddCategory(string)"/>
        public void SetCategoryLabel(int id, string label)
        {
            if (id <= 0)
            {
                throw new ArgumentOutOfRangeException("id", id, (string)null);
            }
            if (label == null)
            {
                throw new ArgumentNullException("label");
            }
            if (label == "")
            {
                throw new ArgumentException("Was empty.", "label");
            }

            Undo.RecordObject(this, TileLang.ParticularText("Action", "Set Category Label"));

            BrushCategoryInfo info;

            if (!this.categoryMap.TryGetValue(id, out info))
            {
                info = new BrushCategoryInfo(id);
                this.categories.Add(info);
                this.categoryMap[id] = info;
            }

            info.Label = label;
            EditorUtility.SetDirty(this);

            ++this.CategoryRevisionCounter;
        }
        /// <summary>
        /// Adds a new brush category.
        /// </summary>
        /// <param name="label">Label for category.</param>
        /// <returns>
        /// The unique category identifier.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        /// If <paramref name="label"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="System.ArgumentException">
        /// If <paramref name="label"/> is an empty string.
        /// </exception>
        /// <seealso cref="SetCategoryLabel(int, string)"/>
        public int AddCategory(string label)
        {
            if (label == null)
            {
                throw new ArgumentNullException("label");
            }
            if (label == "")
            {
                throw new ArgumentException("Was empty.", "label");
            }

            Undo.RecordObject(this, TileLang.ParticularText("Action", "Add Category"));

            var info = new BrushCategoryInfo(this.NextUniqueId(), label);

            this.categories.Add(info);
            EditorUtility.SetDirty(this);

            this.categoryMap[info.Id] = info;
            ++this.CategoryRevisionCounter;

            return(info.Id);
        }