def to_object(record, attribute_map, stringify_keys = false)
      attributes = {}
      attribute_map.each do |map|
        map = map.inject({}) { |memo,(k,v)| memo[k.to_s] = v; memo} if stringify_keys
        if map["with"]
          as = deep_find(record, map["key"], map["nested_key"])
          values = []
          if as.is_a? Array
            values = as.map { |a| strip_refname( deep_find(a, map["with"]) ) }
          elsif as.is_a? Hash and as[ map["with"] ]
            values = as[ map["with"] ].is_a?(Array) ? as[ map["with"] ].map { |a| strip_refname(a) } : [ strip_refname(as[ map["with"] ]) ]
          end
          attributes[map["field"]] = values
        else
          attributes[map["field"]] = deep_find(record, map["key"], map["nested_key"])
        end
      end
      attributes
    end
def to_object(record, attribute_map, stringify_keys = false)
      attributes = {}
      attribute_map.each do |map|
        map = map.inject({}) { |memo,(k,v)| memo[k.to_s] = v; memo} if stringify_keys
        if map["with"]
          as = deep_find(record, map["key"], map["nested_key"])
          values = []
          if as.is_a? Array
            values = as.map { |a| strip_refname( deep_find(a, map["with"]) ) }
          elsif as.is_a? Hash and as[ map["with"] ]
            values = as[ map["with"] ].is_a?(Array) ? as[ map["with"] ].map { |a| strip_refname(a) } : [ strip_refname(as[ map["with"] ]) ]
          end
          attributes[map["field"]] = values
        else
          attributes[map["field"]] = deep_find(record, map["key"], map["nested_key"])
        end
      end
      attributes
    end
parsed record and map to get restructured object