/// <summary>
        /// Adds a new customer purchase into persistence.
        /// </summary>
        /// <param name="newCustomerPurchase">The new customer purchase persistence to add.</param>
        /// <returns>The resulting customer purchase that got added.</returns>
        public async Task <CustomerPurchaseEntity> AddAsync(CustomerPurchaseEntity newCustomerPurchase)
        {
            newCustomerPurchase.AssertNotNull(nameof(newCustomerPurchase));

            CustomerPurchaseTableEntity customerPurchaseTableEntity = new CustomerPurchaseTableEntity(newCustomerPurchase.CustomerId, newCustomerPurchase.SubscriptionId)
            {
                SeatPrice       = newCustomerPurchase.SeatPrice.ToString(),
                SeatsBought     = newCustomerPurchase.SeatsBought,
                TransactionDate = newCustomerPurchase.TransactionDate,
                PurchaseType    = newCustomerPurchase.PurchaseType.ToString()
            };

            var customerPurchasesTable = await this.ApplicationDomain.AzureStorageService.GetCustomerPurchasesTableAsync();

            var insertionResult = await customerPurchasesTable.ExecuteAsync(TableOperation.Insert(customerPurchaseTableEntity));

            insertionResult.HttpStatusCode.AssertHttpResponseSuccess(ErrorCode.PersistenceFailure, "Failed to add customer purchase", insertionResult.Result);

            newCustomerPurchase = new CustomerPurchaseEntity(
                newCustomerPurchase.PurchaseType,
                customerPurchaseTableEntity.RowKey,
                newCustomerPurchase.CustomerId,
                newCustomerPurchase.SubscriptionId,
                newCustomerPurchase.SeatsBought,
                newCustomerPurchase.SeatPrice,
                newCustomerPurchase.TransactionDate);

            return(newCustomerPurchase);
        }
        /// <summary>
        /// Removes a purchase entity from persistence.
        /// </summary>
        /// <param name="customerPurchaseToRemove">The customer purchase to remove.</param>
        /// <returns>A task.</returns>
        public async Task DeleteAsync(CustomerPurchaseEntity customerPurchaseToRemove)
        {
            customerPurchaseToRemove.AssertNotNull(nameof(customerPurchaseToRemove));

            var customerPurchasesTable = await this.ApplicationDomain.AzureStorageService.GetCustomerPurchasesTableAsync();

            var deletionResult = await customerPurchasesTable.ExecuteAsync(
                TableOperation.Delete(new CustomerPurchaseTableEntity(customerPurchaseToRemove.CustomerId, customerPurchaseToRemove.SubscriptionId)
            {
                RowKey = customerPurchaseToRemove.Id, ETag = "*"
            }));

            deletionResult.HttpStatusCode.AssertHttpResponseSuccess(ErrorCode.PersistenceFailure, "Failed to delete customer purchase", deletionResult.Result);
        }