         let locale = decoder.userInfo[CodingUserInfoKey(rawValue: "locale")!] as? Locale
         
         let fields = try container.nestedContainer(keyedBy: GenericCodingKeys.self, forKey: .fields)
-     
-        
-        
-        
         
         for key in fields.allKeys {
             let field = key.stringValue

                    case .string:
                        let stringDict = try fields.decode(StringDict.self, forKey: key)
                        unboxedFields[field] = getValueFromDict(dict: stringDict, locale: locale)
                      
                    case .int:
                        let intDict = try fields.decode(IntDict.self, forKey: key)
                        unboxedFields[field] = getValueFromDict(dict: intDict, locale: locale)
                      
                    case .bool:
                        let boolDict = try fields.decode(BoolDict.self, forKey: key)
                       unboxedFields[field] = getValueFromDict(dict: boolDict, locale: locale)
                     
                    case .decimal:
                        let doubleDict = try fields.decode(DoubleDict.self, forKey: key)
                        unboxedFields[field] = getValueFromDict(dict: doubleDict, locale: locale)
                        
                    case .date:
                        let stringDict = try fields.decode(StringDict.self, forKey: key)
                        let dateString = getValueFromDict(dict: stringDict, locale: locale)
                        let formatter = ISO8601DateFormatter()
                        guard let ds = dateString, let date = formatter.date(from: ds) else { throw DecodingError.fieldFormatError }
                        unboxedFields[field] = date
                      
                    case .reference:
                        let refDict = try fields.decode(RefDict.self, forKey: key)
                        guard let sysDict  = getValueFromDict(dict: refDict, locale: locale),
                            let idDict = sysDict["sys"],
                            let id = idDict["id"] else { throw DecodingError.invalidData }
                        unboxedFields[field] = id
                        
                    }
                    
                    if required && unboxedFields[field] == nil {

    
public struct PageUnboxing {

    public static func unboxResponse<T>(data: Data, locale: Locale?, with fieldUnboxer: @escaping ((String) -> (UnboxedType,Bool)?), via creator: @escaping ((UnboxedFields) -> T?)) -> Result<PagedResult<T>>  {
        let decoder = JSONDecoder()
        
        decoder.userInfo = [CodingUserInfoKey(rawValue: "fieldUnboxer")!: fieldUnboxer, CodingUserInfoKey(rawValue: "creator")!: creator]
