The state variable isn’t updating correctly in the smartapp, I’m using the add and remove functions to maintain a list of active devices to monitor. However as you can see from the output below, it doesnt’ seem to update the state variable. I’ve synchronized it using the synchronize(state) call to avoid issues but it will isn’t working. What’s could be going on?
f5a29d30-4baf-4fef-9f06-b52e3fc07e5d 8:52:15 AM: trace Monitor camera list [d2e9dc37-3a4c-43a6-a7a8-f217edefa2c6]
f5a29d30-4baf-4fef-9f06-b52e3fc07e5d 8:52:09 AM: debug Checking Camera Living Room Camera for Active Motion Alarms
f5a29d30-4baf-4fef-9f06-b52e3fc07e5d 8:52:01 AM: trace Updated monitor camera list 
f5a29d30-4baf-4fef-9f06-b52e3fc07e5d 8:52:01 AM: trace StopMonitor called for camera Living Room Camera, removing camera d2e9dc37-3a4c-43a6-a7a8-f217edefa2c6 from monitor camera list [d2e9dc37-3a4c-43a6-a7a8-f217edefa2c6]
f5a29d30-4baf-4fef-9f06-b52e3fc07e5d 8:52:04 AM: trace Monitor camera list [d2e9dc37-3a4c-43a6-a7a8-f217edefa2c6]
As you can see above, the monitor list contains a list of cameras id’s. When stop monitor is called and after “updated” list to remove the camera id from the list, it shows up  (blank). (great so far)
However the next time Monitor Task is called the list STILL contains the camera id!!
Is the state variable corrupted or is something else going on?
EDIT: For completeness here are the add and remove functions being used:
devMonitored = state.cameraList.remove(event.device.id) // remove camera to stop monitoring }
state.cameraList.add(event.device.id) // add camera to be monitored }