public JsonResult Add(CreateInspectionAreaItemRequest request)
        {
            if (request.InspectionAreaItemID <= 0)
            {
                InspectionAreaItem inspectionAreaItem = new InspectionAreaItem();
                inspectionAreaItem.InspectionAreaItemID = request.InspectionAreaItemID;
                inspectionAreaItem.ItemCondition = request.ItemCondition;
                inspectionAreaItem.ItemDescription = request.ItemDescription;
                inspectionAreaItem.ItemID = request.ItemID;
                inspectionAreaItem.ItemRepair = request.ItemRepair;


                db.InspectionAreaItems.Add(inspectionAreaItem);
                db.SaveChanges();
            }
            else
            {
                InspectionAreaItem inspectionAreaItem = db.InspectionAreaItems.Where(x => x.InspectionAreaItemID == request.InspectionAreaItemID).FirstOrDefault();
                if (inspectionAreaItem != null)
                {
                    inspectionAreaItem.InspectionAreaItemID = request.InspectionAreaItemID;
                    inspectionAreaItem.ItemCondition = request.ItemCondition;
                    inspectionAreaItem.ItemDescription = request.ItemDescription;
                    inspectionAreaItem.ItemID = request.ItemID;
                    inspectionAreaItem.ItemRepair = request.ItemRepair;

                    db.SaveChanges();
                }

            }

            return Json("true");
        }
        public JsonResult Add(CreateInspectionRequest request)
        {
            Inspection inspection = new Inspection()
            {
                PropertyID = request.PropertyID,
                OverallComments = "Test on " + DateTime.Now.ToShortTimeString()
            };

            db.Inspections.Add(inspection);
            db.SaveChanges();

            var propertyAreas = db.Areas.Where(x => x.PropertyID == request.PropertyID).ToList();

            foreach (var propertyArea in propertyAreas)
            {
                InspectionArea area = new InspectionArea()
                {
                    InspectionID = inspection.InspectionID,
                    AreaID = propertyArea.AreaID
                };

                db.InspectionAreas.Add(area);
                db.SaveChanges();

                var areaItems = db.AreaItems.Where(x => x.AreaID == propertyArea.AreaID).ToList();

                foreach (var areaItem in areaItems)
                {
                    InspectionAreaItem item = new InspectionAreaItem()
                    {
                        InspectionAreaID = area.InspectionAreaID,
                        ItemID = areaItem.AreaItemID,
                        ItemDescription = areaItem.RoomItem,
                    };

                    db.InspectionAreaItems.Add(item);
                    db.SaveChanges();
                }
                
            }

            InspectionResponse response = new InspectionResponse();
            response.InspectionID = inspection.InspectionID;
            response.Completed = false;
            return Json(response);
        }