Factor out createProperty into a function.