/// <summary>
        /// Update a specific key of this instance from a given JSON element internally
        /// </summary>
        /// <param name="key">Property name to update</param>
        /// <param name="jsonElement">Element to update this intance from</param>
        /// <param name="ignoreSbcProperties">Whether SBC properties are ignored</param>
        /// <param name="offset">Index offset</param>
        /// <param name="last">Whether this is the last update</param>
        /// <returns>Whether the key could be updated</returns>
        private bool InternalUpdateFromModel(string key, JsonElement jsonElement, bool ignoreSbcProperties, int offset = 0, bool last = true)
        {
            if (string.IsNullOrEmpty(key))
            {
                UpdateFromJson(jsonElement, ignoreSbcProperties);
                return(true);
            }

            if (JsonProperties.TryGetValue(key, out PropertyInfo property))
            {
                if (ignoreSbcProperties && Attribute.IsDefined(property, typeof(LinuxPropertyAttribute)))
                {
                    // Skip this field if it must not be updated from RRF
                    return(true);
                }

                if (property.PropertyType.IsSubclassOf(typeof(ModelObject)))
                {
                    ModelObject value = (ModelObject)property.GetValue(this);
                    value.UpdateFromJson(jsonElement, ignoreSbcProperties);
                    return(true);
                }

                if (ModelCollection.GetItemType(property.PropertyType, out Type itemType))
                {
                    IList modelCollection = (IList)property.GetValue(this);
                    if (ModelGrowingCollection.TypeMatches(property.PropertyType))
                    {
                        ModelGrowingCollectionHelper.UpdateFromJson(modelCollection, itemType, jsonElement, ignoreSbcProperties);
                    }
                    else
                    {
                        ModelCollectionHelper.UpdateFromJson(modelCollection, itemType, jsonElement, ignoreSbcProperties, offset, last);
                    }
                    return(true);
                }

                if (property.PropertyType == typeof(ModelJsonDictionary))
                {
                    ModelJsonDictionary value = (ModelJsonDictionary)property.GetValue(this);
                    value.UpdateFromJson(jsonElement);
                    return(true);
                }

#if VERIFY_OBJECT_MODEL
                Console.WriteLine("[warn] Missing key type handler for {0}", key);
            }
            else
            {
                Console.WriteLine("[warn] Missing property: {0} = {1}", key, jsonElement.GetRawText());
#endif
            }

            // Failed to find a property
            return(false);
        }
        /// <summary>
        /// Update this instance from a given JSON element
        /// </summary>
        /// <param name="jsonElement">Element to update this intance from</param>
        /// <param name="ignoreSbcProperties">Whether SBC properties are ignored</param>
        /// <returns>Updated instance</returns>
        /// <exception cref="JsonException">Failed to deserialize data</exception>
        internal virtual ModelObject UpdateFromJson(JsonElement jsonElement, bool ignoreSbcProperties)
        {
            foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
            {
                if (JsonProperties.TryGetValue(jsonProperty.Name, out PropertyInfo property))
                {
                    if (ignoreSbcProperties && Attribute.IsDefined(property, typeof(LinuxPropertyAttribute)))
                    {
                        // Skip this field if it must not be updated
                        continue;
                    }

                    if (property.PropertyType.IsSubclassOf(typeof(ModelObject)))
                    {
                        ModelObject modelObject = (ModelObject)property.GetValue(this);
                        if (jsonProperty.Value.ValueKind == JsonValueKind.Null)
                        {
                            if (modelObject != null)
                            {
                                if (property.SetMethod != null)
                                {
                                    property.SetValue(this, null);
                                }
#if VERIFY_OBJECT_MODEL
                                else
                                {
                                    Console.WriteLine("[warn] Tried to set unsettable property {0} to null", jsonProperty.Name);
                                }
#endif
                            }
                        }
                        else if (modelObject == null)
                        {
                            modelObject = (ModelObject)Activator.CreateInstance(property.PropertyType);
                            modelObject = modelObject.UpdateFromJson(jsonProperty.Value, ignoreSbcProperties);
                            if (property.SetMethod != null)
                            {
                                property.SetValue(this, modelObject);
                            }
#if VERIFY_OBJECT_MODEL
                            else
                            {
                                Console.WriteLine("[warn] Tried to assign unsettable property {0} = {1}", jsonProperty.Name, jsonProperty.Value.GetRawText());
                            }
#endif
                        }
                        else
                        {
                            ModelObject updatedInstance = modelObject.UpdateFromJson(jsonProperty.Value, ignoreSbcProperties);
                            if (updatedInstance != modelObject)
                            {
                                if (property.SetMethod != null)
                                {
                                    property.SetValue(this, updatedInstance);
                                }
#if VERIFY_OBJECT_MODEL
                                else
                                {
                                    Console.WriteLine("[warn] Tried to assign unsettable property {0} = {1}", jsonProperty.Name, jsonProperty.Value.GetRawText());
                                }
#endif
                            }
                        }
                    }
                    else if (ModelCollection.GetItemType(property.PropertyType, out Type itemType))
                    {
                        IList modelCollection = (IList)property.GetValue(this);
                        if (ModelGrowingCollection.TypeMatches(property.PropertyType))
                        {
                            ModelGrowingCollectionHelper.UpdateFromJson(modelCollection, itemType, jsonProperty.Value, ignoreSbcProperties);
                        }
                        else
                        {
                            ModelCollectionHelper.UpdateFromJson(modelCollection, itemType, jsonProperty.Value, ignoreSbcProperties);
                        }
                    }
                    else if (property.PropertyType == typeof(bool) && jsonProperty.Value.ValueKind == JsonValueKind.Number)
                    {
                        try
                        {
                            if (property.SetMethod != null)
                            {
                                property.SetValue(this, Convert.ToBoolean(jsonProperty.Value.GetInt32()));
#if VERIFY_OBJECT_MODEL
                                Console.WriteLine("[warn] Updating bool value from number {0} = {1}", jsonProperty.Name, jsonProperty.Value.GetRawText());
#endif
                            }
#if VERIFY_OBJECT_MODEL
                            else
                            {
                                Console.WriteLine("[warn] Tried to assign unsettable property {0} = {1}", jsonProperty.Name, jsonProperty.Value.GetRawText());
                            }
#endif
                        }
                        catch (FormatException e)
                        {
                            throw new JsonException($"Failed to deserialize property [{GetType().Name}].{property.Name} (type bool) from JSON {jsonProperty.Value.GetRawText()}", e);
                        }
                    }
                    else
                    {
                        try
                        {
                            object newValue = JsonSerializer.Deserialize(jsonProperty.Value.GetRawText(), property.PropertyType);
                            if (property.SetMethod != null)
                            {
                                property.SetValue(this, newValue);
                            }
#if VERIFY_OBJECT_MODEL
                            else
                            {
                                Console.WriteLine("[warn] Tried to assign unsettable property {0} = {1}", jsonProperty.Name, jsonProperty.Value.GetRawText());
                            }
#endif
                        }
                        catch (JsonException e)
                        {
                            throw new JsonException($"Failed to deserialize property [{GetType().Name}].{property.Name} (type {property.PropertyType.Name}) from JSON {jsonProperty.Value.GetRawText()}", e);
                        }
                    }
                }
#if VERIFY_OBJECT_MODEL
                else if (jsonProperty.Name != "seqs")
                {
                    Console.WriteLine("[warn] Missing property: {0} = {1}", jsonProperty.Name, jsonProperty.Value.GetRawText());
                }
#endif
            }
            return(this);
        }