public static void Go() { OrgHierarchyCreator creator = new OrgHierarchyCreator(); var parent = creator.GetEnterpriseOrgUnit(); creator.CreateBrandsAndDivisions(parent); }
public static void Main(string[] args) { try { OrgHierarchyCreator.Go(); } catch (AggregateException aggregateException) { var innerException = aggregateException.InnerException; if (innerException is ApiException) { var apiException = innerException as ApiException; var responseBody = apiException.Response.Content.ReadAsStringAsync().Result; Console.Error.WriteLine(responseBody); } else { Console.Error.WriteLine(aggregateException); } } catch (Exception e) { Console.Error.WriteLine(e); } finally { Console.WriteLine("Finished! Press Enter"); Console.ReadLine(); } }