# File lib/ohm.rb, line 1334
    def save
      indices = {}
      model.indices.each do |field|
        next unless (value = send(field))
        indices[field] = Array(value).map(&:to_s)
      end

      uniques = {}
      model.uniques.each do |field|
        next unless (value = send(field))
        uniques[field] = value.to_s
      end

      features = {
        "name" => model.name
      }

      if defined?(@id)
        features["id"] = @id
      end

      @id = script(LUA_SAVE, 0,
        features.to_json,
        _sanitized_attributes.to_json,
        indices.to_json,
        uniques.to_json
      )

      return self
    end