internal static Model DeserializeModel(JsonElement element)
        {
            ModelInfo   modelInfo   = default;
            KeysResult  keys        = default;
            TrainResult trainResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("modelInfo"))
                {
                    modelInfo = ModelInfo.DeserializeModelInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("keys"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    keys = KeysResult.DeserializeKeysResult(property.Value);
                    continue;
                }
                if (property.NameEquals("trainResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    trainResult = TrainResult.DeserializeTrainResult(property.Value);
                    continue;
                }
            }
            return(new Model(modelInfo, keys, trainResult));
        }
        internal static Model DeserializeModel(JsonElement element)
        {
            CustomFormModelInfo    modelInfo   = default;
            Optional <KeysResult>  keys        = default;
            Optional <TrainResult> trainResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("modelInfo"))
                {
                    modelInfo = CustomFormModelInfo.DeserializeCustomFormModelInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("keys"))
                {
                    keys = KeysResult.DeserializeKeysResult(property.Value);
                    continue;
                }
                if (property.NameEquals("trainResult"))
                {
                    trainResult = TrainResult.DeserializeTrainResult(property.Value);
                    continue;
                }
            }
            return(new Model(modelInfo, keys.Value, trainResult.Value));
        }
        internal static Model DeserializeModel(JsonElement element)
        {
            CustomFormModelInfo    modelInfo   = default;
            Optional <KeysResult>  keys        = default;
            Optional <TrainResult> trainResult = default;
            Optional <IReadOnlyList <TrainResult> > composedTrainResults = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("modelInfo"))
                {
                    modelInfo = CustomFormModelInfo.DeserializeCustomFormModelInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("keys"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    keys = KeysResult.DeserializeKeysResult(property.Value);
                    continue;
                }
                if (property.NameEquals("trainResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    trainResult = TrainResult.DeserializeTrainResult(property.Value);
                    continue;
                }
                if (property.NameEquals("composedTrainResults"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TrainResult> array = new List <TrainResult>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TrainResult.DeserializeTrainResult(item));
                    }
                    composedTrainResults = array;
                    continue;
                }
            }
            return(new Model(modelInfo, keys.Value, trainResult.Value, Optional.ToList(composedTrainResults)));
        }