private static async Task <ActorEntity> InsertOrMergeEntityAsync(CloudTable table, ActorEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("Entity cannot be null!");
            }
            try
            {
                // Create the InsertOrReplace table operation
                TableOperation insertOrMergeOperation = TableOperation.InsertOrMerge(entity);

                // Execute the operation.
                TableResult result = await table.ExecuteAsync(insertOrMergeOperation);

                ActorEntity insertedActor = result.Result as ActorEntity;

                // Get the request units consumed by the current operation. RequestCharge of a TableResult is only applied to Azure CosmoS DB
                if (result.RequestCharge.HasValue)
                {
                    Console.WriteLine("Request Charge of InsertOrMerge Operation: " + result.RequestCharge);
                }

                return(insertedActor);
            }
            catch (StorageException ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
                throw;
            }
        }
        private async Task <ActorBase> GetPersistedActorAsync(string actorId)
        {
            TableOperation retrieveOperation = TableOperation.Retrieve <ActorEntity>(this.actorSystemId, actorId);
            TableResult    result            = await this.table.ExecuteAsync(retrieveOperation);

            ActorEntity customer = result.Result as ActorEntity;

            if (customer == null)
            {
                return(null);
            }
            else
            {
                return(DeserializeActor <ActorBase>(customer.SerializedActor));
            }
        }