DevicesForCase.includes(deviceID)) {
                window.selectedDevicesForCase.push(deviceID);
            }
        });
        renderAvailableDevicesForCase();
    }

    function clearAllSelections() {
        window.selectedDevicesForCase = [];
        renderAvailableDevicesForCase();
    }

    function updateSelectionCounter() {
        const counter = document.getElementById('selectionCounter');
        if (counter) {
            const count = window.selectedDevicesForCase.length;
            cou