private async Task <bool> InvokePreparationOnActors()
        {
            bool success = false;

            foreach (string actor in TransactionLedger.Keys)
            {
                if (!TransactionLedger[actor] || !distributedTransactionActors.ContainsKey(actor))
                {
                    success = false;
                    Logger.LogError($"Preparation failed either because Transaction actor: {actor} was not enlisted or do not belong to distributed transaction.");
                    break;
                }

                string endpointName = distributedTransactionActors[actor];

                using (TransactionActorProxy transactionActorProxy = proxyFactory.CreateProxy <TransactionActorProxy, ITransactionActorContract>(endpointName))
                {
                    if (transactionActorProxy == null)
                    {
                        success = false;
                        string message = "TransactionActorProxy is null.";
                        Logger.LogError(message);
                        throw new NullReferenceException(message);
                    }

                    success = await transactionActorProxy.Prepare();
                }

                if (success)
                {
                    Logger.LogInfo($"Preparation on Transaction actor: {actor} finsihed SUCCESSFULLY.");
                }
                else
                {
                    Logger.LogInfo($"Preparation on Transaction actor: {actor} finsihed UNSUCCESSFULLY.");
                    break;
                }
            }

            return(success);
        }
        private void InvokeRollbackOnActors()
        {
            foreach (string actor in TransactionLedger.Keys)
            {
                if (distributedTransactionActors.ContainsKey(actor))
                {
                    string endpointName = distributedTransactionActors[actor];

                    using (TransactionActorProxy transactionActorProxy = proxyFactory.CreateProxy <TransactionActorProxy, ITransactionActorContract>(endpointName))
                    {
                        if (transactionActorProxy == null)
                        {
                            string message = "TransactionActorProxy is null.";
                            Logger.LogError(message);
                            throw new NullReferenceException(message);
                        }

                        transactionActorProxy.Rollback();
                        Logger.LogInfo($"Rollback invoked on Transaction actor: {actor}.");
                    }
                }
            }
        }