             updateCaseDeviceCount(caseID);
                }, 200);
            })
            .catch(error => {
                alert('Error removing device from case: ' + error.message);
            });
        }
    }

    function deleteCase(caseID) {
        if (confirm('Are you sure you want to delete this case?')) {
            fetch('/api/v1/cases/' + caseID, {
                method: 'DELETE'
            })
            .then(response => response.json())
            .then(result => {
              