private void MakeHouseSums([NotNull] MyDb dbArchive, [NotNull] SaveableEntry <Prosumer> sa, [NotNull] Dictionary <string, string> houseNames)
        {
            Debug("started summing up the houses");
            ArchiveEntry currentAeLoad = new ArchiveEntry("",
                                                          new AnalysisKey(null, null, SumType.ByHouse, GenerationOrLoad.Load, "", null, null),
                                                          Profile.MakeConstantProfile(0, "", Profile.ProfileResolution.QuarterHour),
                                                          GenerationOrLoad.Load, "");
            ArchiveEntry currentAeGen = new ArchiveEntry("",
                                                         new AnalysisKey(null, null, SumType.ByHouse, GenerationOrLoad.Generation, "", null, null),
                                                         Profile.MakeConstantProfile(0, "", Profile.ProfileResolution.QuarterHour),
                                                         GenerationOrLoad.Generation, "");
            var saHouses = SaveableEntry <ArchiveEntry> .GetSaveableEntry(dbArchive, SaveableEntryTableType.SummedHouseProfiles, Services.Logger);

            saHouses.MakeCleanTableForListOfFields(false);
            int           count = 0;
            List <string> processedHouseNames = new List <string>();

            foreach (var prosumer in sa.ReadEntireTableDBAsEnumerable("HouseGuid"))
            {
                count++;
                string houseName = houseNames[prosumer.HouseGuid];
                if (houseName != currentAeLoad.Key.HouseName && !string.IsNullOrWhiteSpace(currentAeLoad.Key.HouseName))
                {
                    saHouses.AddRow(currentAeLoad);
                    saHouses.AddRow(currentAeGen);
                    if (saHouses.RowEntries.Count > 50)
                    {
                        saHouses.SaveDictionaryToDatabase(MyLogger);
                    }
                    if (processedHouseNames.Contains(houseName))
                    {
                        throw new FlaException("Duplicate house name");
                    }
                    processedHouseNames.Add(houseName);
                }

                if (houseName != currentAeLoad.Key.HouseName)
                {
                    currentAeLoad = new ArchiveEntry(houseName,
                                                     new AnalysisKey(null, null, SumType.ByHouse, GenerationOrLoad.Load, houseName, null, null),
                                                     Profile.MakeConstantProfile(0, houseName, Profile.ProfileResolution.QuarterHour),
                                                     GenerationOrLoad.Load, prosumer.TrafoKreis ?? throw new FlaException("No trafokreis"));
                    currentAeGen = new ArchiveEntry(houseName,
                                                    new AnalysisKey(null, null, SumType.ByHouse, GenerationOrLoad.Generation, houseName, null, null),
                                                    Profile.MakeConstantProfile(0, houseName, Profile.ProfileResolution.QuarterHour),
                                                    GenerationOrLoad.Generation, prosumer.TrafoKreis);
                }

                switch (prosumer.GenerationOrLoad)
                {
                case GenerationOrLoad.Generation:
                    currentAeGen.Profile = currentAeGen.Profile.Add(prosumer.Profile ?? throw new FlaException(), currentAeGen.Name);
                    break;

                case GenerationOrLoad.Load:
                    currentAeLoad.Profile = currentAeLoad.Profile.Add(prosumer.Profile ?? throw new FlaException(), currentAeGen.Name);
                    break;

                default: throw new FlaException("Forgotten type");
                }
                if (count % 1000 == 0)
                {
                    Info("Subtotal house Processing count: " + count);
                }
            }

            saHouses.SaveDictionaryToDatabase(MyLogger);
            Debug("Finished saving the remaining houses");
        }