     
     fileprivate func offsetIndex(_ index: UnderlyingCollection.Index, by offset: Int) -> UnderlyingCollection.Index {
         var offsetIndex = index
-        list.formIndex(&offsetIndex, offsetBy: offset)
+        collection.formIndex(&offsetIndex, offsetBy: offset)
         return offsetIndex
     }
     

        var indices: [UnderlyingCollection.Index] = [from]
        var i = from
        while i != to {
            list.formIndex(after: &i)
            indices.append(i)
        }
        return indices

    }
}

public class ObservableCollection<UnderlyingCollection: Collection & DataSourceProtocol>: SignalProtocol {
    public fileprivate(set) var collection: UnderlyingCollection
    public let subject = PublishSubject<ObservableCollectionEvent<UnderlyingCollection>, NoError>()
    public let lock = NSRecursiveLock(name: "com.reactivekit.bond.observable-collection")
    
    public init(_ list: UnderlyingCollection) {
        collection = list
    }
    
    public func makeIterator() -> UnderlyingCollection.Iterator {
        return collection.makeIterator()
    }
    
    public var underestimatedCount: Int {
        return collection.underestimatedCount
    }
    
    public var startIndex: UnderlyingCollection.Index {
        return collection.startIndex
    }
    
    public var endIndex: UnderlyingCollection.Index {
        return collection.endIndex
    }
    
    public func index(after i: UnderlyingCollection.Index) -> UnderlyingCollection.Index {
        return collection.index(after: i)
    }
    
    public var isEmpty: Bool {
        return collection.isEmpty
    }
    
    public var count: Int {
        return collection.count
    }
    
    public subscript(index: UnderlyingCollection.Index) -> UnderlyingCollection.Element {
        return collection[index]
    }
    
    public func observe(with observer: @escaping (Event<ObservableCollectionEvent<UnderlyingCollection>, NoError>) -> Void) -> Disposable {
        observer(.next(ObservableCollectionEvent(change: .reset, source: collection)))
        return subject.observe(with: observer)
    }
    
