/** Creates a member map for the type */
        private Dictionary <string, MemberInfo> CreateMemberMap(Type objectType)
        {
            Dictionary <string, MemberInfo> memberMap;

            if (this.MemberMapCache.TryGetValue(objectType, out memberMap))
            {
                // map was stored in cache
                return(memberMap);
            }

            // create a new map
            memberMap = new Dictionary <string, MemberInfo>();

            // load properties into property map
            Type tp = objectType;

            while (tp != null)
            {
                PropertyInfo[] properties = TCU.GetTypeInfo(tp).GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                for (int i = 0; i < properties.Length; i++)
                {
                    PropertyInfo info = properties [i];
                    if (!info.CanRead || !info.CanWrite)
                    {
                        continue;
                    }

                    if (JsonIgnoreAttribute.IsJsonIgnore(info))
                    {
                        continue;
                    }

                    string jsonName = JsonNameAttribute.GetJsonName(info);
                    if (String.IsNullOrEmpty(jsonName))
                    {
                        memberMap[info.Name] = info;
                    }
                    else
                    {
                        memberMap[jsonName] = info;
                    }
                }

                // load public fields into property map
                FieldInfo[] fields = TCU.GetTypeInfo(tp).GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                foreach (FieldInfo info in fields)
                {
                    if (!info.IsPublic &&
        #if WINDOWS_STORE
                        info.GetCustomAttribute <JsonMemberAttribute>(false) == null
        #else
                            (info.GetCustomAttributes(typeof(JsonMemberAttribute), false).Length == 0)
        #endif
                        )
                    {
                        continue;
                    }

                    if (JsonIgnoreAttribute.IsJsonIgnore(info))
                    {
                        continue;
                    }

                    string jsonName = JsonNameAttribute.GetJsonName(info);
                    if (String.IsNullOrEmpty(jsonName))
                    {
                        memberMap[info.Name] = info;
                    }
                    else
                    {
                        memberMap[jsonName] = info;
                    }

                    var formerlySerializedAs = info.GetCustomAttributes(typeof(JsonFormerlySerializedAsAttribute), true);
                    if (formerlySerializedAs.Length > 0)
                    {
                        var formerName = (formerlySerializedAs [0] as JsonFormerlySerializedAsAttribute).name;
                        if (!String.IsNullOrEmpty(formerName) && !memberMap.ContainsKey(formerName))
                        {
                            memberMap [formerName] = info;
                        }
                    }
                }

                tp = tp.BaseType;
            }

            // store in cache for repeated usage
            this.MemberMapCache[objectType] = memberMap;

            return(memberMap);
        }