Duplicate device rows if settings are saved

Insert on the devices table is done each time settings are saved.