/// <summary>
        ///     Adds an attribute index to an existing table, feature class, shapefile, coverage, or attributed relationship class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="name">
        ///     The name of the new index. An index name is necessary when adding an index to geodatabase feature
        ///     classes and tables. For other data types, such as shapefiles and coverage feature classes, index names cannot be
        ///     specified.
        /// </param>
        /// <param name="fields">
        ///     The list of fields that can participate in an attribute index. Any number of these fields can be
        ///     part of the index.
        /// </param>
        /// <param name="unique">if set to <c>true</c> when the values in the index are unique.</param>
        /// <param name="ascending">if set to <c>true</c> when the values are indexed in ascending order.</param>
        /// <param name="trackCancel">The track cancel.</param>
        /// <param name="eventHandler">The events.</param>
        public static void AddIndex(this ITable source, string name, string[] fields, bool unique, bool ascending, ITrackCancel trackCancel, IGeoProcessorEvents eventHandler)
        {
            AddIndex gp = new AddIndex();

            gp.in_table   = source;
            gp.index_name = name;
            gp.fields     = string.Join(";", fields);
            gp.unique     = unique ? "UNIQUE" : "NON_UNIQUE";
            gp.ascending  = ascending ? "ASCENDING" : "NON_ASCENDING";
            gp.Run(trackCancel, eventHandler);
        }