internal static IEnumerable <string> DistinctValues(this SPField field)
        {
            if (field is SPFieldModStat)
            {
                var tempVals = field.DistinctValues(0);
                var statuses = new Dictionary <int, string>
                {
                    { 0, SPResource.GetString("ModerationStatusApproved", new object[0]) },
                    { 1, SPResource.GetString("ModerationStatusRejected", new object[0]) },
                    { 2, SPResource.GetString("ModerationStatusPending", new object[0]) },
                    { 3, SPResource.GetString("ModerationStatusDraft", new object[0]) },
                    { 4, SPResource.GetString("ModerationStatusScheduled", new object[0]) }
                };
                return(tempVals.Select(t => statuses[t]));
            }
            switch (field.Type)
            {
            case SPFieldType.Lookup:
                return(field.IsMulti()
                               ? field.DistinctMultiLookupValues().Select(v => v.Value)
                               : field.DistinctLookupValues().Select(v => v.Value));

            case SPFieldType.User:
                return(field.IsMulti()
                               ? field.DistinctMultiUserValues().Select(v => v.Value)
                               : field.DistinctUserValues().Select(v => v.Value));

            case SPFieldType.DateTime:
                return(field
                       .DistinctDateTimeValues(DateTime.MinValue)
                       .Where(x => x != DateTime.MinValue)
                       .Select(x => x.ToShortDateString()));

            case SPFieldType.Boolean:
                return(field.DistinctValues(false).Select(b => b.ToString()));

            default:
                return(field.DistinctValues(string.Empty));
            }
        }