     
     var section: WebcamSection?
     var webcams: Results<Webcam>?
-    var task: DispatchWorkItem?
     var takenFromPool = [WebcamView]()
     
     weak var delegate: WebcamCarouselTableViewCellDelegate?

    }
    
    func configure(with item: ItemType) {
        let sortedWebcams = item.sortedWebcams()

        carousel.alpha = 0
        section = item
        
        task?.cancel()
        task = DispatchWorkItem { [weak self] in
            self?.layoutIfNeeded()
            self?.carousel.layoutIfNeeded()
            
            self?.webcams = sortedWebcams
            self?.carousel.reloadData()
            
            UIView.animate(
                withDuration: 0.3,
                delay: 0,
                options: [.allowUserInteraction],
                animations: { [weak self] in
                    self?.carousel.alpha = 1
                },
                completion: nil)
        }
        
        if let task = task {
            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5,
                                          execute: task)
        }
        
        // Configure header
        let currentWebcam = sortedWebcams[safe: carousel.currentItemIndex] ?? sortedWebcams.first

        sectionImageView.image = item.image
        sectionTitleLabel.text = item.title?.uppercased()

    }
    
    func carousel(_ carousel: iCarousel, viewForItemAt index: Int, reusing view: UIView?) -> UIView {
        guard let webcams = webcams else { return UIView() }

        var webcamView: WebcamView
        let webcam = webcams[index % webcams.count]
        let width: CGFloat = UIScreen.main.bounds.width * widthRatio()
        let height: CGFloat = min(width * 0.55, carousel.bounds.height * 0.95)
        
