private void CustomerReportGenerateSQL()
        {
            using (MyPowerShell ps = new MyPowerShell())
            {
                ps.GetCustomerReportSQL(model.CustomerReport.Organization);
                var result       = ps.Invoke().Single();
                var aduser       = (PSObject)result.Properties["ADUser"].Value;
                var server       = (PSObject)result.Properties["Server"].Value;
                var office365    = (PSObject)result.Properties["Office365"].Value;
                var fileserver   = (PSObject)result.Properties["FileServer"].Value;
                var totalstorage = (PSObject)result.Properties["Totalstorage"].Value;
                var users        = (Object[])aduser.Properties["Users"].Value;
                var servers      = (Object[])server.Properties["Servers"].Value;
                var info365s     = (Object[])office365.Properties["Info"].Value;

                var database = (PSObject)result.Properties["Database"].Value;


                model.CustomerReport.DatabasefUsage = double.Parse(database.Properties["TotalUsage"].Value.ToString()) / 1024 / 1024 / 1024;
                model.CustomerReport.DatabaseUsage  = model.CustomerReport.DatabasefUsage.ToString("F1") + " GB";

                model.CustomerReport.TotalfUsage = double.Parse(totalstorage.Properties["TotalAllocated"].Value.ToString());
                model.CustomerReport.TotalUsage  = model.CustomerReport.TotalfUsage.ToString("F1") + " GB";

                model.CustomerReport.FileServerfTotal = double.Parse(fileserver.Properties["Allocated"].Value.ToString());
                model.CustomerReport.FileServerTotal  = model.CustomerReport.FileServerfTotal.ToString("F1") + " GB";
                model.CustomerReport.FileServerfFree  = double.Parse(fileserver.Properties["FreeSpace"].Value.ToString());
                model.CustomerReport.FileServerFree   = model.CustomerReport.FileServerfFree.ToString("F1") + " GB";
                model.CustomerReport.FileServerfUsed  = double.Parse(fileserver.Properties["Used"].Value.ToString());
                model.CustomerReport.FileServerUsed   = model.CustomerReport.FileServerfUsed.ToString("F1") + " GB";

                model.CustomerReport.ADUsersCount      = 0;
                model.CustomerReport.ADFullUsersCount  = 0;
                model.CustomerReport.ADLightUsersCount = 0;
                model.CustomerReport.ENTServersCount   = 0;

                if (users != null)
                {
                    foreach (PSObject user in users)
                    {
                        model.CustomerReport.ADUsersCount++;
                        model.CustomerReport.ADUsers.Add(new ADUser
                        {
                            Email     = user.Properties["PrimarySmtpAddress"].Value.ToString(),
                            Name      = user.Properties["DisplayName"].Value.ToString(),
                            LightUser = user.Properties["LightUser"].Value.ToString(),
                        });
                        string testUser    = user.Properties["TestUser"].Value.ToString();
                        string type        = user.Properties["Type"].Value.ToString();
                        string disabled    = user.Properties["Disabled"].Value.ToString();
                        string displayName = user.Properties["DisplayName"].Value.ToString();
                        string lightuser   = user.Properties["LightUser"].Value.ToString();

                        // Do not add MailOnly accounts to Windows nor Office.
                        if (lightuser.Equals("True"))
                        {
                            model.CustomerReport.Licenses.LightUser.Add(displayName);
                            model.CustomerReport.ADLightUsersCount++;
                        }
                        else
                        {
                            model.CustomerReport.ADFullUsersCount++;
                            model.CustomerReport.Licenses.FullUser.Add(displayName);
                        }
                    }
                }
                else
                {
                    throw new Exception("There are no AD Users registered yet.. Can the customer be charged just yet?");
                }

                model.CustomerReport.ADUsers.OrderBy(x => x);

                foreach (PSObject ent in servers)
                {
                    model.CustomerReport.ENTServers.Add(new ENTServer
                    {
                        OS   = ent.Properties["OperatingSystem"].Value.ToString(),
                        Name = ent.Properties["Name"].Value.ToString(),
                        CPU  = ent.Properties["CPUCount"].Value.ToString(),
                        RAM  = (double.Parse(ent.Properties["Memory"].Value.ToString()) / 1024).ToString("F1") + " GB"
                    });
                    model.CustomerReport.ENTServersCount++;
                }

                foreach (PSObject info in info365s)
                {
                    model.CustomerReport.Info365s.Add(new Info365
                    {
                        License       = info.Properties["License"].Value.ToString(),
                        PartnerName   = info.Properties["PartnerName"].Value.ToString(),
                        ActiveUnits   = info.Properties["ActiveUnits"].Value.ToString(),
                        ConsumedUnits = info.Properties["ConsumedUnits"].Value.ToString(),
                        FreeUnits     = info.Properties["FreeUnits"].Value.ToString(),
                    });
                }
                //throw new Exception(mailbox.Properties["TotalAllocated"].Value.ToString());
            }
        }