def resolve_foreign_keys(object, map)
      object.foreign_keys.each do |property|
        value = object[property]
        if value
          if map.key?(value)
            object[property] = map[value]
          else
            raise Errors::MissingDatabaseIdError, "couldn't resolve foreign key: #{property} #{value}"
          end
        end
      end
    end
def resolve_foreign_keys(object, map)
      object.foreign_keys.each do |property|
        value = object[property]
        if value
          if map.key?(value)
            object[property] = map[value]
          else
            raise Errors::MissingDatabaseIdError, "couldn't resolve foreign key: #{property} #{value}"
          end
        end
      end
    end
Resolves an object's foreign keys from object IDs to database IDs.

 @param [Object] an object
 @param [Hash] a map from object ID to database ID
 @raises [Pupa::Errors::MissingDatabaseIdError] if a foreign key cannot be
   resolved