public bool AddSensorMeasurement(Guid deviceId, double?pm25, double?pm10, double?temperature, double?humidity, double?pressure, double?heaterTemperature, double?heaterHumidity, double?rssi, double?cellVoltage)
 {
     _logger.LogInformation($"In Add sensor measurement for device id: {deviceId}");
     try
     {
         var measurement = new Measurements()
         {
             DeviceId          = deviceId,
             Pm25              = pm25,
             Pm10              = pm10,
             HeaterHumidity    = heaterHumidity,
             HeaterTemperature = heaterTemperature,
             Humidity          = humidity,
             InsertDateTime    = DateTimeOffset.Now,
             Pressure          = pressure,
             Temperature       = temperature,
             CellVoltage       = cellVoltage,
             WifiRssi          = rssi
         };
         //_jsonUpdatesRepository.SaveUpdate(deviceId, measurement);
         _context.Measurements.Add(measurement);
         return(_context.SaveChanges() >= 1);
     }
     catch (Exception ex) {
         _logger.LogError(ex, "Error when saving measurement data!");
         return(false);
     }
 }
 public bool SaveUpdate <T>(Guid deviceId, T data)
 {
     _logger.LogInformation("Save JSON DATA");
     try
     {
         var jsonData = JsonConvert.SerializeObject(data, Formatting.None, new JsonSerializerSettings {
             ReferenceLoopHandling = ReferenceLoopHandling.Ignore
         });
         _context.JsonUpdates.Add(new Database.Models.JsonUpdates()
         {
             DeviceId = deviceId, InsertDateTime = DateTimeOffset.Now, JsonValue = jsonData
         });
         return(_context.SaveChanges() > 0);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "Error when Save JSON DATA");
         return(false);
     }
 }