private ITypeHandler GetTypeHandler(Type propertyType, UmbracoPropertyAttribute propertyMetaData)
        {
            // TODO: this can be cleaned up... perhaps a total rethink of the architecture

            //Get the attribute's property name value
            var classMetaData = propertyType.GetCustomAttributes(typeof(UmbracoEntityAttribute), true).FirstOrDefault() as
                                UmbracoEntityAttribute;

            if (classMetaData?.TypeHandlerOverride != null)
            {
                // Check for type-level override
                return(classMetaData.TypeHandlerOverride.CreateWithNoParams <ITypeHandler>());
            }

            if (propertyMetaData?.TypeHandler != null)
            {
                // Check for property-level override
                return(propertyMetaData.TypeHandler);
            }

            // Attempt to find default handler

            // If it's generic, get the underlying type and return it as a nullable with a value, otherwise null.
            if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
            {
                var innerType        = Nullable.GetUnderlyingType(propertyType);
                var innerTypeHandler = _typeHandlerFactory.GetHandlerForType(innerType);
                if (innerTypeHandler != null)
                {
                    var nullableTypeHandlerType = typeof(NullableTypeHandler <>);
                    // ReSharper disable once PossibleNullReferenceException - Shouldn't happen (KMS 31 MAR 2016)
                    return((ITypeHandler)nullableTypeHandlerType.MakeGenericType(innerType).GetConstructor(new[] { typeof(ITypeHandler) }).Invoke(new object[] { innerTypeHandler }));
                }
            }

            // Check for a default handler for this type.
            var factoryHandler = _typeHandlerFactory.GetHandlerForType(propertyType);

            if (factoryHandler != null)
            {
                return(factoryHandler);
            }

            if (classMetaData?.GetType() == typeof(UmbracoEntityAttribute))
            {
                // Finally, if no other handler has been found yet, AND the target type is an Entity
                // then let's attempt to recursively get the content
                return(new UmbracoEntityTypeHandler());
            }

            // Otherwise, we got nothing
            return(null);
        }