internal static void ForEachParam(this Dictionary <string, object> values, ModelDefinition modelDef, bool excludeDefaults, ParamIterDelegate fn)
        {
            if (values == null)
            {
                return;
            }

            foreach (var kvp in values)
            {
                var value = kvp.Value;

                if (excludeDefaults && (value == null || value.Equals(value.GetType().GetDefaultValue())))
                {
                    continue;
                }

                var targetField = modelDef?.FieldDefinitions.FirstOrDefault(f => string.Equals(f.Name, kvp.Key));
                var columnName  = !string.IsNullOrEmpty(targetField?.Alias)
                    ? targetField.Alias
                    : kvp.Key;

                fn(kvp.Key, columnName, value);
            }
        }
        internal static void ForEachParam <T>(this object anonType, bool excludeDefaults, ParamIterDelegate fn)
        {
            if (anonType == null)
            {
                return;
            }

            var pis   = anonType.GetType().GetSerializableProperties();
            var model = ModelDefinition <T> .Definition;

            foreach (var pi in pis)
            {
                var mi = pi.GetGetMethod();
                if (mi == null)
                {
                    continue;
                }

                var value = mi.Invoke(anonType, new object[0]);
                if (excludeDefaults && (value == null || value.Equals(pi.PropertyType.GetDefaultValue())))
                {
                    continue;
                }

                var targetField = model != null?model.FieldDefinitions.FirstOrDefault(f => String.Equals(f.Name, pi.Name)) : null;

                var columnName = targetField != null && !String.IsNullOrEmpty(targetField.Alias)
                    ? targetField.Alias
                    : pi.Name;

                fn(pi, columnName, value);
            }
        }