private ControlledSerializationJsonConverter(
     IEnumerable <Type> supportedTypes,
     int recursionDepth,
     bool ignoreDuplicates,
     bool ignoreNotSupported,
     Dictionary <Type, Func <object, string> > formatters,
     bool ignoreScriptIgnoreAttribute,
     IEnumerable <Type> supremeTypes,
     int currentRecursionDepth,
     List <object> history,
     ControlledSerializationJsonConverter parent)
 {
     if (supportedTypes == null || supportedTypes.Count() == 0)
     {
         throw new ArgumentException("SupportedTypes can't be null or empty", nameof(supportedTypes));
     }
     this.recursionDepth              = recursionDepth;
     this.ignoreDuplicates            = ignoreDuplicates;
     this.ignoreNotSupported          = ignoreNotSupported;
     this.ignoreScriptIgnoreAttribute = ignoreScriptIgnoreAttribute;
     this.supportedTypes              = ExtractTypes(supportedTypes);
     this.formatters            = formatters;
     this.supremeTypes          = supremeTypes ?? StandardSimpleTypes;
     this.currentRecursionDepth = currentRecursionDepth;
     this.history = history;
     this.parent  = parent;
 }
        private IDictionary <string, object> LayerUp(string propertyName, object value)
        {
            var js = new ControlledSerializationJsonConverter(supportedTypes, recursionDepth - currentRecursionDepth, ignoreDuplicates, ignoreNotSupported, formatters, ignoreScriptIgnoreAttribute, supremeTypes,
                                                              currentRecursionDepth, history, this);
            var jss        = new JavaScriptSerializer();
            var dictionary = js.Serialize(value, jss);

            return(dictionary);
        }