public override TPatchRequest Create(IReadOnlyDictionary <string, object> json)
        {
            Dictionary <string, object> normalized =
                this.Normalize(json)
                .ToDictionary(
                    (KeyValuePair <string, object> item) => item.Key,
                    (KeyValuePair <string, object> item) => item.Value);

            if (normalized.TryGetValue(ProtocolAttributeNames.Operations, out object operations))
            {
                normalized.Remove(ProtocolAttributeNames.Operations);
            }
            TPatchRequest result = base.Create(normalized);

            if (operations != null)
            {
                IReadOnlyCollection <PatchOperation2Base> patchOperations =
                    PatchRequest2DeserializingFactory <TPatchRequest, TOperation> .Deserialize(operations);

                foreach (PatchOperation2Base patchOperation in patchOperations)
                {
                    result.AddOperation(patchOperation as TOperation);
                }
            }
            return(result);
        }
        private static IReadOnlyCollection <PatchOperation2Base> Deserialize(object operations)
        {
            IReadOnlyCollection <PatchOperation2Base> result;

            switch (operations)
            {
            case ArrayList list:
                result = PatchRequest2DeserializingFactory <TPatchRequest, TOperation> .Deserialize(list);

                return(result);

            case object[] array:
                result = PatchRequest2DeserializingFactory <TPatchRequest, TOperation> .Deserialize(array);

                return(result);

            default:
                string unsupported = operations.GetType().FullName;
                throw new NotSupportedException(unsupported);
            }
        }
        private static IReadOnlyCollection <PatchOperation2Base> Deserialize(object[] operations)
        {
            if (null == operations)
            {
                throw new ArgumentNullException(nameof(operations));
            }

            List <PatchOperation2Base> result = new List <PatchOperation2Base>(operations.Length);

            foreach (Dictionary <string, object> json in operations)
            {
                if
                (
                    PatchRequest2DeserializingFactory <TPatchRequest, TOperation> .TryDeserialize(
                        json,
                        out PatchOperation2Base patchOperation)
                )
                {
                    result.Add(patchOperation);
                }
            }
            return(result);
        }