public async Task <CreateOperationResult> EditStrain(int strainId, Strain strain)
        {
            using (var dbContext = new GrowFlowContext())
            {
                using (var service = ComplianceService.Create(dbContext, account))
                {
                    Strain facility = dbContext.Set <Strain>().AsNoTracking()
                                      .FirstOrDefault(s => s.AccountId == account.Id && s.Id == strainId);

                    if (facility == null)
                    {
                        return(new CreateOperationResult()
                        {
                            Success = false,
                            Exception = "Unable to edit strain.  No facility location exists for this account."
                        });
                    }

                    try
                    {
                        // strain.Daysinflower = .Daysinflower;

                        dbContext.Strains.Attach(strain);

                        var entry = dbContext.Entry(strain);
                        entry.State = EntityState.Modified;

                        dbContext.SaveChanges();

                        return(new CreateOperationResult()
                        {
                            Success = true,
                            Data = strain
                        });
                    }
                    catch (Exception e)
                    {
                        return(new CreateOperationResult()
                        {
                            Success = false,
                            Exception = e.Message
                        });
                    }
                }
            }
        }
        public async Task <CreateOperationResult> CreateRoom(CreateRoomDTO dto)
        {
            using (var dbContext = new GrowFlowContext())
            {
                using (var service = ComplianceService.Create(dbContext, account))
                {
                    Site facility = dbContext.Set <Site>().AsNoTracking()
                                    .SingleOrDefault(s => s.AccountId == account.Id && s.Type == SiteType.Facility);

                    if (facility == null)
                    {
                        return(new CreateOperationResult()
                        {
                            Success = false,
                            Exception = "Unable to create room.  No facility location exists for this account."
                        });
                    }

                    try
                    {
                        var result = await service.CreateRoomAsync(
                            account,
                            facility,
                            dto.Name,
                            dto.Type,
                            dto.Notes);

                        return(new CreateOperationResult()
                        {
                            Success = true,
                            Data = result
                        });
                    }
                    catch (Exception e)
                    {
                        return(new CreateOperationResult()
                        {
                            Success = false,
                            Exception = e.Message
                        });
                    }
                }
            }
        }