public ContentMetaData GetResourceMemberData(Resource resource, ContentTypeUsage contentTypeUsage)
        {
            var contentMetaData = new ContentMetaData();

            switch (contentTypeUsage)
            {
            case ContentTypeUsage.Readable:

                if (resource.ReadContentType.Property != null)
                {
                    contentMetaData.MemberCount += resource.ReadContentType.Property.Count();

                    contentMetaData.Members.AddRange(
                        resource.ReadContentType.Property.Select(property => property.name));
                }

                if (resource.ReadContentType.Object != null)
                {
                    UpdateContentMetaData(resource.ReadContentType.Object, contentMetaData);
                }

                if (resource.ReadContentType.Collection != null)
                {
                    UpdateContentMetaData(resource.ReadContentType.Collection, contentMetaData);
                }

                break;

            case ContentTypeUsage.Writable:

                if (resource.WriteContentType.Property != null)
                {
                    contentMetaData.MemberCount += resource.WriteContentType.Property.Count();

                    contentMetaData.Members.AddRange(
                        resource.WriteContentType.Property.Select(property => property.name));
                }

                if (resource.WriteContentType.Object != null)
                {
                    UpdateContentMetaData(resource.WriteContentType.Object, contentMetaData);
                }

                if (resource.WriteContentType.Collection != null)
                {
                    UpdateContentMetaData(resource.WriteContentType.Collection, contentMetaData);
                }

                break;
            }

            return(contentMetaData);
        }
        private static void UpdateContentMetaData(ClassDefinition[] collections, ContentMetaData contentMetaData)
        {
            if (collections == null)
            {
                return;
            }

            foreach (ClassDefinition collection in collections)
            {
                contentMetaData.MemberCount++;
                contentMetaData.Members.Add(collection.name);

                if (collection.Property != null)
                {
                    contentMetaData.MemberCount += collection.Property.Count();
                    contentMetaData.Members.AddRange(collection.Property.Select(property => property.name));
                }

                if (collection.Collection != null && collection.Collection.Any())
                {
                    UpdateContentMetaData(collection.Collection, contentMetaData);
                }
            }
        }