def check_array_collapse(data, field_def)
      result = data
      if !field_def[:min_occurs].nil? &&
          (field_def[:max_occurs] == :unbounded ||
              (!field_def[:max_occurs].nil? && field_def[:max_occurs] > 1)) &&
                  !(field_def[:type] =~ /MapEntry$/)
        result = arrayize(result)
      end
      return result
    end
def check_array_collapse(data, field_def)
      result = data
      if !field_def[:min_occurs].nil? &&
          (field_def[:max_occurs] == :unbounded ||
              (!field_def[:max_occurs].nil? && field_def[:max_occurs] > 1)) &&
                  !(field_def[:type] =~ /MapEntry$/)
        result = arrayize(result)
      end
      return result
    end
Checks if the field signature allows an array and forces array structure
 even for a signle item.