internal static LastDetectionResult DeserializeLastDetectionResult(JsonElement element)
        {
            Optional <IReadOnlyList <VariableState> > variableStates = default;
            Optional <IReadOnlyList <AnomalyState> >  results        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("variableStates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <VariableState> array = new List <VariableState>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VariableState.DeserializeVariableState(item));
                    }
                    variableStates = array;
                    continue;
                }
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <AnomalyState> array = new List <AnomalyState>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(AnomalyState.DeserializeAnomalyState(item));
                    }
                    results = array;
                    continue;
                }
            }
            return(new LastDetectionResult(Optional.ToList(variableStates), Optional.ToList(results)));
        }