public Location ToLocation() { var location = new Location(X, Y, Name, Description, FilePaths.NormalizePath(Image)); if (Monsters?.Any() ?? false) { foreach (var encounter in Monsters) { var availableMonster = MonsterFactory.Get(encounter.Id); if (availableMonster != null) { location.AddEncounter(encounter.Id, encounter.Chance); } else { Trace.TraceWarning($"Location({Name}) has monster {encounter.Id} that could not be found"); } } ; } ; if (Quests?.Any() ?? false) { foreach (var quest in Quests) { var availableQuest = QuestFactory.FindQuest(quest.Id); if (availableQuest != null) { location.AddQuest(availableQuest); } else { Trace.TraceWarning($"Location({Name}) has quest {quest.Id} that could not be found"); } } ; } ; if (Trader > 0) { var availableTader = TraderFactory.GetTrader(Trader); if (availableTader != null) { location.TraderHere = availableTader; } else { Trace.TraceWarning($"Location({Name}) has tracer '{Trader}' that could not be found"); } } ; return(location); }