public ActionResult Manage()
        {
            var model = new SensorModel
            {
                Sensors = _sensorService.GetAll().ToList()
            };

            return View(model);
        }
        public HttpResponseMessage Create(SensorModel model)
        {
            if (ModelState.IsValid)
            {
                var sensor = new Sensor()
                {
                    ApiKey = model.ApiKey,
                    Type = model.Type,
                    Name = model.Name,
                    IsActive = true
                };

                _sensorService.Create(sensor);
                return Request.CreateResponse(HttpStatusCode.OK, sensor);

            }

            return Request.CreateResponse(HttpStatusCode.BadRequest, "[ERROR]: Sensor could not be added because there was missing or invalid data provided.");
        }
        public ActionResult Manage(SensorModel model)
        {
            if (ModelState.IsValid)
            {
                var sensor = new Sensor()
                {
                    Type = model.Type,
                    Name = model.Name,
                    IsActive = true
                };

                _sensorService.Create(sensor);
                ViewBag.Message = "Sensor has been created successfully";
                return RedirectToAction("Manage");
            }

            model.Sensors = _sensorService.GetAll().ToList();
            return View(model);
        }
        public HttpResponseMessage Update(SensorModel model)
        {
            if (ModelState.IsValid)
            {
                var sensor = _sensorService.Get(model.Id);
                if (sensor == null) return Request.CreateResponse(HttpStatusCode.NotFound);

                sensor.Name = model.Name;
                sensor.Type = model.Type;
                sensor.IsActive = sensor.IsActive;

                _sensorService.Update(sensor);
                return Request.CreateResponse(HttpStatusCode.OK, sensor);
            }

            return Request.CreateResponse(HttpStatusCode.BadRequest, "[ERROR]: Sensor could not be updated because there was missing or invalid data provided.");
        }
        public ActionResult Sensor(Guid id)
        {
            var sensor = _sensorService.Get(id);
            if (sensor == null) return HttpNotFound();

            var model = new SensorModel()
            {
                Id = sensor.Id,
                ApiKey = sensor.ApiKey,
                Type = sensor.Type,
                Name = sensor.Name,
                IsActive = sensor.IsActive,
                Readings = _dataReadingService.GetAll(sensor.Id).ToList()
            };

            return View(model);
        }