public IList <TableResult> ExecuteBatch(TableBatchOperation batch)
            {
                TableOperation[] operations = batch.ToArray();

                if (operations.Length == 0)
                {
                    return(new List <TableResult>());
                }

                // Ensure all operations are for the same partition.
                string firstPartitionKey = operations[0].Entity.PartitionKey;

                if (operations.Any(o => o.Entity.PartitionKey != firstPartitionKey))
                {
                    throw new InvalidOperationException("All operations in a batch must have the same partition key.");
                }

                // Ensure each row key is only present once.
                if (operations.GroupBy(o => o.Entity.RowKey).Any(g => g.Count() > 1))
                {
                    throw new InvalidOperationException("All operations in a batch must have distinct row keys.");
                }

                List <TableResult> results = new List <TableResult>();

                foreach (TableOperation operation in operations)
                {
                    // For test purposes, use an easier (non-atomic) implementation.
                    TableResult result = Execute(operation);
                    results.Add(result);
                }

                return(results);
            }