def to_hash(arr)
      arr.map(&:flatten).map { |p| { 'key' => p.first.to_s, 'value' => p.last.to_s } }
    end
def to_hash(arr)
      arr.map(&:flatten).map { |p| { 'key' => p.first.to_s, 'value' => p.last.to_s } }
    end
Convert an array of attributes into a hash consumable by the API.

 @param [Array[Hash]] arr Array of attributes to convert.
 @return [Array[Hash]] Array formatted as expected by the API.