public static async Task <NewTableViewModel> CreateInstanceAsync(Authentication authentication, ITableCategoryDescriptor descriptor) { if (authentication == null) { throw new ArgumentNullException(nameof(authentication)); } if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } if (descriptor.Target is ITableCategory category) { var template = await category.NewTableAsync(authentication); return(await category.Dispatcher.InvokeAsync(() => { return new NewTableViewModel(authentication, category, template); })); } else { throw new ArgumentException("Invalid Target of Descriptor", nameof(descriptor)); } }