private ModelDescription GenerateComplexTypeModelDescription(Type modelType)
        {
            ComplexTypeModelDescription complexModelDescription = new ComplexTypeModelDescription
            {
                Name = ModelNameHelper.GetModelName(modelType),
                ModelType = modelType,
                Documentation = CreateDefaultDocumentation(modelType)
            };

            GeneratedModels.Add(complexModelDescription.Name, complexModelDescription);
            bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null;
            PropertyInfo[] properties = modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
            foreach (PropertyInfo property in properties)
            {
                if (ShouldDisplayMember(property, hasDataContractAttribute))
                {
                    ParameterDescription propertyModel = new ParameterDescription
                    {
                        Name = GetMemberName(property, hasDataContractAttribute)
                    };

                    if (DocumentationProvider != null)
                    {
                        propertyModel.Documentation = DocumentationProvider.GetDocumentation(property);
                    }

                    GenerateAnnotations(property, propertyModel);
                    complexModelDescription.Properties.Add(propertyModel);
                    propertyModel.TypeDescription = GetOrCreateModelDescription(property.PropertyType);
                }
            }

            FieldInfo[] fields = modelType.GetFields(BindingFlags.Public | BindingFlags.Instance);
            foreach (FieldInfo field in fields)
            {
                if (ShouldDisplayMember(field, hasDataContractAttribute))
                {
                    ParameterDescription propertyModel = new ParameterDescription
                    {
                        Name = GetMemberName(field, hasDataContractAttribute)
                    };

                    if (DocumentationProvider != null)
                    {
                        propertyModel.Documentation = DocumentationProvider.GetDocumentation(field);
                    }

                    complexModelDescription.Properties.Add(propertyModel);
                    propertyModel.TypeDescription = GetOrCreateModelDescription(field.FieldType);
                }
            }

            return complexModelDescription;
        }
        private List<string> GetGridColumnsSorting(ComplexTypeModelDescription ComplexModel)
        {
            var properties = new List<string>();
            foreach (var par in ComplexModel.Properties)
            {
                var simplePar = par.TypeDescription as SimpleTypeModelDescription;
                if (simplePar != null)
                {
                    //todo: to be tested, in case of Datetime => obs.datajs
                    //if(simplePar.ModelType == typeof(DateTime)
                    //   || simplePar.ModelType == typeof(DateTime?))
                    //{
                    //    properties.Add(ToJsName(par.Name) + ".datajs");
                    //}

                    properties.Add(ToJsName(par.Name));
                    continue;
                }

                //chiamata ricorsiva per complex model
                var innerComplexModel = par.TypeDescription as ComplexTypeModelDescription;
                if (innerComplexModel != null)
                {
                    var innerProperties = GetGridColumnsSorting(innerComplexModel);

                    //aggiungo navigazione (ad. es reparto.nome)
                    var innerPropertiesWithNavi = innerProperties.Select(p => ToJsName(par.Name) + "." + p);
                    properties.AddRange(innerPropertiesWithNavi);
                    continue;
                }
            }
            return properties;
        }