protected void SetModelPropertiesValues <TModel>(string contents, TModel modelInstance)
        {
            Type modelType = modelInstance.GetType();

            PropertyInfo[] modelProperties = modelType.GetProperties();

            string pattern;

            foreach (PropertyInfo propertyInfo in modelProperties)
            {
                if ((pattern = propertyInfo.GetPropertyPattern()) == null)
                {
                    continue;
                }

                object propertyValue = GetPropertyValue(propertyInfo.PropertyType, contents, pattern);

                FilterAttribute filterAttribute = propertyInfo.GetCustomAttribute <FilterAttribute>();
                if (filterAttribute != null)
                {
                    Type originalType = propertyValue.GetType();
                    propertyValue = filterAttribute.OnValueSetting(propertyValue, originalType);
                    Type returnedType = propertyValue.GetType();

                    /*if (!returnedType.IsAssignableFrom(originalType))
                     * {
                     *      throw new InvalidOperationException($"Original type ({originalType.Name}) must match with the returned type from {nameof(FilterAttribute)}. Returned type was {returnedType.Name}.");
                     * }*/
                }

                propertyInfo.SetValue(modelInstance, propertyValue);
            }
        }