def cast(parent, value)
      return value unless casted
      if array
        if value.nil?
          value = []
        elsif value.is_a?(Hash)
          # Assume provided as a params hash where key is index
          value = parameter_hash_to_array(value)
        elsif !value.is_a?(Array)
          raise "Expecting an array or keyed hash for property #{parent.class.name}##{self.name}"
        end
        arr = value.collect { |data| cast_value(parent, data) }
        arr.reject!{ |data| data.nil? } unless allow_blank
        # allow casted_by calls to be passed up chain by wrapping in CastedArray
        CastedArray.new(arr, self, parent)
      elsif !value.nil?
        cast_value(parent, value)
      end
    end
def cast(parent, value)
      return value unless casted
      if array
        if value.nil?
          value = []
        elsif value.is_a?(Hash)
          # Assume provided as a params hash where key is index
          value = parameter_hash_to_array(value)
        elsif !value.is_a?(Array)
          raise "Expecting an array or keyed hash for property #{parent.class.name}##{self.name}"
        end
        arr = value.collect { |data| cast_value(parent, data) }
        arr.reject!{ |data| data.nil? } unless allow_blank
        # allow casted_by calls to be passed up chain by wrapping in CastedArray
        CastedArray.new(arr, self, parent)
      elsif !value.nil?
        cast_value(parent, value)
      end
    end
Cast the provided value using the properties details.