If a model has a property that is a complex type, this line throws an invalid cast exception.
I tried to modify the code to flatten out the first layer of a complex type (i.e., assuming all properties of the complex type are scalar properties) but I ran into an issue when trying to add the function to the ConceptualStoreMapping.