public IHttpActionResult SaveDevice([FromBody] Device newDevice)
 {
     try
     {
         List <Device> devices      = ConfigurationAccess.GetDeviceListFromConfig();
         List <Device> savedDevices = DeviceListHandler.SaveNewDeviceInDeviceList(devices, newDevice);
         ConfigurationAccess.SaveDeviceListToConfig(savedDevices);
         return(Ok());
     }
     catch (ReadWriteException ex)
     {
         return(BadRequest(ex.Message));
     }
 }
 public IHttpActionResult DeleteDevice(String id)
 {
     try
     {
         List <Device> devices      = ConfigurationAccess.GetDeviceListFromConfig();
         List <Device> modifiedList = DeviceListHandler.DeleteDeviceInDeviceList(devices, id);
         ConfigurationAccess.SaveDeviceListToConfig(modifiedList);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
 public IHttpActionResult UpdateDevice([FromBody] Device updatedDevice)
 {
     try
     {
         List <Device> devicesInConfig = ConfigurationAccess.GetDeviceListFromConfig();
         List <Device> updatedList     = DeviceListHandler.UpdateDeviceInDeviceList(devicesInConfig, updatedDevice);
         ConfigurationAccess.SaveDeviceListToConfig(updatedList);
         return(Ok());
     }
     catch (ReadWriteException ex)
     {
         return(BadRequest(ex.Message));
     }
 }