Introduce onCollectionLock & onCollectionUnlock callbacks

Can we copy ResourceId? We can have onCollectionLock() return ResourceId that is then passed as argument to onCollectionUnlock().