Adding logic for checking DeviceCode using ArrayList