             }
         }
     }
-    
+
     private func doneCallbackBlock(propertyExtractor: PropertyExtractorType) -> AsyncTypes<Value, Error>.DidFinishAsyncCallback {
-        
+
         return { (result: AsyncResult<Value, Error>) -> () in
-            
+
             //TODO test this if
             //may happen when cancel
             if propertyExtractor.cacheObject == nil {

        //so set loader again
        setAsyncLoader(loader)
    }
    
    //private def getObjectRelatedPropertyData: ObjectRelatedPropertyData[ValueT] = {
    func getObjectRelatedPropertyData() -> ObjectRelatedPropertyData<ValueT, ErrorT>
    {
        let resultOption = cacheObject!.delegatesByKey[uniqueKey]
        
        if let result = resultOption {
            return result
        }
        
        let result = ObjectRelatedPropertyData<ValueT, ErrorT>()
        cacheObject!.delegatesByKey[uniqueKey] = result
        return result
    }
    
    func copyDelegates() -> [CallbacksBlocksHolder<ValueT, ErrorT>] {
        return getObjectRelatedPropertyData().copyDelegates()
    }
    
    func eachDelegate(block: (obj: CallbacksBlocksHolder<ValueT, ErrorT>) -> ()) {
        return getObjectRelatedPropertyData().eachDelegate(block)
    }
    
    func hasDelegates() -> Bool {
        return getObjectRelatedPropertyData().hasDelegates()
    }
    
    func clearDelegates() {
        getObjectRelatedPropertyData().clearDelegates()
    }
    
    //func getDelegates: mutable.ArrayBuffer[CallbacksBlocksHolder[ValueT]] = {
    func addDelegate(delegate: CallbacksBlocksHolder<ValueT, ErrorT>) {
        getObjectRelatedPropertyData().addDelegate(delegate)
    }
    
    func removeDelegate(delegate: CallbacksBlocksHolder<ValueT, ErrorT>) {
        getObjectRelatedPropertyData().removeDelegate(delegate)
    }
    
    func getLoaderHandler() -> AsyncHandler? {
        return getObjectRelatedPropertyData().loaderHandler
    }
    
    func setLoaderHandler(handler: AsyncHandler?) {
        getObjectRelatedPropertyData().loaderHandler = handler
    }
    
    //def getAsyncLoader: Async[ValueT] =
    func getAsyncLoader() -> AsyncTypes<ValueT, ErrorT>.Async? {
        return getObjectRelatedPropertyData().asyncLoader
    }
    
    //def setAsyncLoader(loader: Async[ValueT])
    func setAsyncLoader(loader: AsyncTypes<ValueT, ErrorT>.Async?) {
        getObjectRelatedPropertyData().asyncLoader = loader
    }
    
    func getAsyncResult() -> AsyncResult<ValueT, ErrorT>? {
        return getterOption?()
    }
    
    func clear() {
        
        if cleared {
            return
        }
        
        cacheObject!.delegatesByKey.removeValueForKey(uniqueKey)
        
        setterOption = nil
        getterOption = nil
        cacheObject  = nil
        
        cleared = true
    }
}

    }
}

final private class ObjectRelatedPropertyData<Value, Error: ErrorType> {

    //var delegates    : mutable.ArrayBuffer[CallbacksBlocksHolder[T]] = null
    var delegates = [CallbacksBlocksHolder<Value, Error>]()

    var loaderHandler: AsyncHandler?
    //var asyncLoader  : Async[T] = null
    var asyncLoader  : AsyncTypes<Value, Error>.Async?

    func copyDelegates() -> [CallbacksBlocksHolder<Value, Error>] {

        let result = delegates.map { callbacks -> CallbacksBlocksHolder<Value, Error> in

            return CallbacksBlocksHolder(
                progressCallback: callbacks.progressCallback,
                stateCallback   : callbacks.stateCallback   ,
                finishCallback  : callbacks.finishCallback)
        }
        return result
    }

    func clearDelegates() {
        for callbacks in delegates {
            callbacks.clearCallbacks()
        }
        delegates.removeAll(keepCapacity: false)
    }

    func eachDelegate(block: (obj: CallbacksBlocksHolder<Value, Error>) -> ()) {
        for element in delegates {
            block(obj: element)
        }
    }

    func hasDelegates() -> Bool {
        return delegates.count > 0
    }

    //func getDelegates: mutable.ArrayBuffer[CallbacksBlocksHolder[ValueT]] = {
    func addDelegate(delegate: CallbacksBlocksHolder<Value, Error>) {
        delegates.append(delegate)
    }

    func removeDelegate(delegate: CallbacksBlocksHolder<Value, Error>) {
        for (index, callbacks) in delegates.enumerate() {
            if delegate === callbacks {
