private void SaveDebitor(int ClientId)
        {
            if (SelectedDebitor.DebitorId == 0)
            {
                int DebitorNumber = CostAccounts.GetNextDebitorNumber();
                SelectedDebitor.RefClientId = CompanyViewModel.Client.ClientId;
                SelectedDebitor.CostAccount.RefTaxTypeId             = CompanyViewModel.SelectedTaxTypeId;
                SelectedDebitor.CostAccount.AccountNumber            = DebitorNumber;
                SelectedDebitor.CostAccount.RefCostAccountCategoryId =
                    CostAccountCategories.GetDebitorId();
                SelectedDebitor.CostAccount.Description = CompanyViewModel.Client.Name;
                SelectedDebitor.CostAccount.IsVisible   = true;
                SelectedDebitor.RefCostAccountId        =
                    CostAccounts.Insert(SelectedDebitor.CostAccount);
                Debitors.Insert(SelectedDebitor);
            }
            else
            {
                Clients.Update(CompanyViewModel.Client);
                if (CompanyViewModel.SelectedClientType == ClientType.Business)
                {
                    Companies.Update(CompanyViewModel.Client.Company);
                }

                CostAccounts.Update(SelectedDebitor.CostAccount);
                Debitors.Update(SelectedDebitor);
            }
        }
 public void RefreshLists()
 {
     CostAccountCategoryList          = CostAccountCategories.GetAll().ToSvenTechCollection();
     CostAccountCategoriesHierachical = CostAccountCategoryList.ToHierachicalCollection <CostAccountCategory>()
                                        .ToSvenTechCollection();
     TaxTypeList   = TaxTypes.GetAll().ToSvenTechCollection();
     _CostAccounts = CostAccounts.GetAll().ToSvenTechCollection();
 }