public async Task Render(SoftwareSystemWithInfrastructure softwareSystem) { BeforeRender(); try { var azureInfrastructureElements = softwareSystem.ElementsWithInfrastructure().Distinct(); foreach (var elementsInLocation in azureInfrastructureElements.GroupBy(e => _resourceLocationTargetingStrategy.TargetLocation(_environment, e))) { foreach (var elementsInResourceGroup in elementsInLocation.GroupBy(e => _resourceGroupTargetingStrategy.TargetResourceGroup(_environment, e))) { await DeployInfrastructure(elementsInResourceGroup.Key, elementsInLocation.Key, elementsInResourceGroup.ToList(), softwareSystem.System.Name); } } } catch (Exception e) { Console.WriteLine(e); throw; } }