# File lib/couchrest/mixins/properties.rb, line 38
      def cast_keys
        return unless self.class.properties
        self.class.properties.each do |property|
          next unless property.casted
          key = self.has_key?(property.name) ? property.name : property.name.to_sym
          target = property.type
          if target.is_a?(Array)
            next unless self[key]
            klass = ::CouchRest.constantize(target[0])
            self[property.name] = self[key].collect do |value|
              # Auto parse Time objects
              obj = ( (property.init_method == 'new') && klass == Time) ? Time.parse(value) : klass.send(property.init_method, value)
              obj.casted_by = self if obj.respond_to?(:casted_by)
              obj
            end
          else
            # Auto parse Time objects
            self[property.name] = if ((property.init_method == 'new') && target == 'Time') 
              self[key].is_a?(String) ? Time.parse(self[key].dup) : self[key]
            else
              # Let people use :send as a Time parse arg
              klass = ::CouchRest.constantize(target)
              # I'm not convince we should or should not create a new instance if we are casting a doc/extended doc without default value and nothing was passed
              # unless (property.casted && 
              #   (klass.superclass == CouchRest::ExtendedDocument || klass.superclass == CouchRest::Document) && 
              #     (self[key].nil? || property.default.nil?))
              klass.send(property.init_method, self[key])
              #end
            end
            self[property.name].casted_by = self if self[property.name].respond_to?(:casted_by)
          end
        end
      end