public void CreateDimension <TResult>(TResult obj) where TResult : class { var resultType = typeof(TResult); if (resultType == typeof(Customer)) { var command = new CreateCustomerCommand { Customer = obj as Customer }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Supplier)) { var command = new CreateSupplierCommand { Supplier = obj as Supplier }; _processXml.Process(command.ToXml()); } if (resultType == typeof(BalanceSheet)) { var command = new CreateGeneralLedgerCommand { GeneralLedger = obj as BalanceSheet }; _processXml.Process(command.ToXml()); } if (resultType == typeof(ProfitLoss)) { var command = new CreateGeneralLedgerCommand { GeneralLedger = obj as ProfitLoss }; _processXml.Process(command.ToXml()); } if (resultType == typeof(CostCenter)) { var command = new CreateCostCenterCommand { CostCenter = obj as CostCenter }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Article)) { var command = new CreateArticleCommand { Article = obj as Article }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Data.SalesInvoice.SalesInvoice)) { var command = new CreateSalesInvoiceCommand { SalesInvoice = obj as Data.SalesInvoice.SalesInvoice }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Vat)) { var command = new CreateVatCommand { Vat = obj as Vat }; _processXml.Process(command.ToXml()); } if (resultType == typeof(Currency)) { var command = new CreateCurrencyCommand { Currency = obj as Currency }; _processXml.Process(command.ToXml()); } if (resultType == typeof(DimensionType)) { var command = new UpdateDimensionTypeCommand { DimensionType = obj as DimensionType }; _processXml.Process(command.ToXml()); } }