public bool registerBay(BayRequest bay)
        {
            try
            {
                new DatabaseUpdate().registerBay(bay);

                foreach (BayDeviceRequest device in bay.listOfBayDevices)
                {
                    device.requestID = bay.requestID;
                    new DatabaseUpdate().registerBayDevice(device);
                }

                foreach (BayLineRequest line in bay.listOfBayLines)
                {
                    line.requestID = bay.requestID;
                    registerBayLine(line);
                }

                foreach (BayRackRequest rack in bay.listOfBayRacks)
                {
                    rack.requestID = bay.requestID;
                    registerBayRack(rack);
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
 public void registerBay(BayRequest bay)
 {
     if (!(new AiGrow.Business.BL_Bay().doesBayExist(bay.bay_unique_id)))
     {
         new BL_Bay().insert(new ML_Bay()
         {
             bay_unique_id = bay.bay_unique_id,
             greenhouse_id = bay.greenhouse_id
         });
     }
     else
     {
         BaseResponse response = new BaseResponse();
         response.success      = false;
         response.errorMessage = UniversalProperties.DUPLICATE_BAY;
         response.errorCode    = UniversalProperties.EC_RegistrationError;
         response.requestID    = bay.requestID;
         response.deviceID     = bay.bay_unique_id;
         string responseJSON = new JavaScriptSerializer().Serialize(response);
         new MQTTHandler().Publish(UniversalProperties.MQTT_topic, responseJSON);
     }
 }