         return !self.isSuccess
     }
 }
+
+

    }
    
    // MARK: - Element
    public static func raccoonResponseSerializer<T: Insertable> (type: T.Type, context: InsertContext = NoContext(), converter: ResponseConverter? = nil) -> ResponseSerializer <T, NSError> {
        
        return ResponseSerializer { request, response, data, error in
            
            // Transform to json
            let baseSerializer = raccoonJSONSerializer(converter) as ResponseSerializer<[String: AnyObject], NSError>
            let baseResponse = baseSerializer.serializeResponse(request, response, data, error)
            
            guard baseResponse.isSuccess else {
                return .Failure(baseResponse.error!)
            }
            
            // Check if the context is valid
            guard let context = context.context(forType: T.self) as? T.ContextType else {
                return .Failure(NSError(domain: RaccoonResponseSerializerDomain,
                    code: InvalidContextTypeErrorCode,
                    userInfo: nil))
            }
            
            // Serialize
            do {
                let convertedObject: T = try T.createOne(baseResponse.value!, context: context) as! T
                return .Success(convertedObject)
            }
            
            catch let error as NSError {
                return .Failure(error)
            }
        }
    }
    
    public func response<T: Insertable>(type: T.Type, context: InsertContext = NoContext(), converter: ResponseConverter? = nil,
        completionHandler: (Response<T, NSError>) -> Void) -> Self {
            
        let serializer = Request.raccoonResponseSerializer(T.self, context: context, converter: converter) as ResponseSerializer <T, NSError>
            return response(responseSerializer: serializer, completionHandler: completionHandler)
    }
    
    // MARK: - Array
    public static func raccoonResponseSerializer<T: Insertable> (type: [T].Type, context: InsertContext = NoContext(), converter: ResponseConverter? = nil) -> ResponseSerializer <[T], NSError> {
        
        return ResponseSerializer { request, response, data, error in

            // Transform to json
            let baseSerializer = raccoonJSONSerializer(converter) as ResponseSerializer<[AnyObject], NSError>
            let baseResponse = baseSerializer.serializeResponse(request, response, data, error)
            
            guard baseResponse.isSuccess else {
                return .Failure(baseResponse.error!)
            }
            
            // Check if the context is valid
            guard let context = context.context(forType: T.self) as? T.ContextType else {
                return .Failure(NSError(domain: RaccoonResponseSerializerDomain,
                    code: InvalidContextTypeErrorCode,
                    userInfo: nil))
            }
            
            // Serialize
            do {
                let convertedObject: [T] = try T.createMany(baseResponse.value!, context: context) as! [T]
                return .Success(convertedObject)
            }
                
            catch let error as NSError {
                return .Failure(error)
            }
        }
    }

    
    public func response<T: Insertable>(type: [T].Type, context: InsertContext = NoContext(), converter: ResponseConverter? = nil,
        completionHandler: (Response<[T], NSError>) -> Void) -> Self {
            
        let serializer = Request.raccoonResponseSerializer([T].self, context: context, converter: converter) as ResponseSerializer<[T], NSError>
            return response(responseSerializer: serializer, completionHandler: completionHandler)
    }
    
    // MARK: - Wrapper
    public static func raccoonResponseSerializer<T: Wrapper> (type: T.Type, context: InsertContext = NoContext(), converter: ResponseConverter? = nil) -> ResponseSerializer <T, NSError> {
        
        return ResponseSerializer { request, response, data, error in
            // Transform to json
            let baseSerializer = raccoonJSONSerializer(converter) as ResponseSerializer<[String: AnyObject], NSError>
            let baseResponse = baseSerializer.serializeResponse(request, response, data, error)
            
            guard error == nil else {
                return .Failure(error!)
            }
            
            // Convert
            let json = baseResponse.value!
            let convertedObject = T(dictionary: json, context: context)!
            
            return .Success(convertedObject)
    
        }
    }
    
    public func response<T: Wrapper>(type: T.Type, context: InsertContext = NoContext(), converter: ResponseConverter? = nil,
        completionHandler: (Response<T, NSError>) -> Void) -> Self {
            
        let serializer = Request.raccoonResponseSerializer(T.self, context: context, converter: converter) as ResponseSerializer<T, NSError>
            return response(responseSerializer: serializer, completionHandler: completionHandler)
    }
    
    // MARK: - Empty

                            if response.result.isSuccess {
                                completionHandler(.Success)
                            }
                                
                            else {
                                completionHandler(.Failure(error: response.result.error!))
                            }
        })
    }
}

private func callHandler<O, R>(handler: (Response<R, NSError>) -> Void, response: Response<O, NSError>, result: Result<R, NSError>) {
    handler(Response(request: response.request,
        response: response.response,
        data: response.data,
        result: result))
}

public enum EmptyResponse {
