Added inserting new devices to SQL and saving existing devices to SQL