internal void PersistDbCache()
        {
            // TODO: performance issue: Batch insert

            // first collect all T_* entities
            List <T_ProductionOrderBom> tProductionOrderBoms =
                _productionOrderBoms.GetAllAs <T_ProductionOrderBom>();
            List <T_StockExchange> tStockExchangeDemands =
                _stockExchangeDemands.GetAllAs <T_StockExchange>();
            List <T_StockExchange> tStockExchangesProviders =
                _stockExchangeProviders.GetAllAs <T_StockExchange>();
            List <T_ProductionOrder> tProductionOrders =
                _productionOrders.GetAllAs <T_ProductionOrder>();
            List <T_ProductionOrderOperation> tProductionOrderOperations =
                _productionOrderOperations.GetAllAsT_ProductionOrderOperation();
            List <T_PurchaseOrderPart> tPurchaseOrderParts =
                _purchaseOrderParts.GetAllAs <T_PurchaseOrderPart>();
            List <T_CustomerOrderPart> tCustomerOrderParts =
                _customerOrderParts.GetAllAs <T_CustomerOrderPart>();
            List <T_CustomerOrder> tCustomerOrders = _customerOrders.GetAllAsTCustomerOrders();

            // Insert all T_* entities
            InsertOrUpdateRange(tProductionOrders, _productionDomainContext.ProductionOrders,
                                _productionDomainContext);
            InsertOrUpdateRange(tProductionOrderOperations,
                                _productionDomainContext.ProductionOrderOperations, _productionDomainContext);
            InsertOrUpdateRange(tProductionOrderBoms, _productionDomainContext.ProductionOrderBoms,
                                _productionDomainContext);
            InsertOrUpdateRange(tStockExchangeDemands, _productionDomainContext.StockExchanges,
                                _productionDomainContext);
            InsertOrUpdateRange(tCustomerOrders, _productionDomainContext.CustomerOrders,
                                _productionDomainContext);
            InsertOrUpdateRange(tCustomerOrderParts, _productionDomainContext.CustomerOrderParts,
                                _productionDomainContext);

            // providers
            InsertOrUpdateRange(tStockExchangesProviders, _productionDomainContext.StockExchanges,
                                _productionDomainContext);
            InsertOrUpdateRange(tPurchaseOrderParts, _productionDomainContext.PurchaseOrderParts,
                                _productionDomainContext);
            InsertOrUpdateRange(_purchaseOrders, _productionDomainContext.PurchaseOrders,
                                _productionDomainContext);

            // at the end: T_DemandToProvider & T_ProviderToDemand
            InsertOrUpdateRange(DemandToProviderGetAll().Select(x => (T_DemandToProvider)x),
                                _productionDomainContext.DemandToProviders, _productionDomainContext);
            if (ProviderToDemandGetAll().Any())
            {
                InsertOrUpdateRange(ProviderToDemandGetAll().Select(x => (T_ProviderToDemand)x),
                                    _productionDomainContext.ProviderToDemand, _productionDomainContext);
            }

            _productionDomainContext.SaveChanges();
        }