public async Task <IdentityResult> DeleteAsync(TUser user,
                                                       CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            cancellationToken.ThrowIfCancellationRequested();

            TableOperation executeOperation = TableOperation.Delete(user);

            try
            {
                TableResult result = await AuthCloudTable.ExecuteAsync(executeOperation, cancellationToken);
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed deleting user {user.RowKey}", ex);
            }

            return(IdentityResult.Success);
        }
        public async Task <TUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            TUser fetchedUser = null;

            if (string.IsNullOrEmpty(normalizedEmail))
            {
                throw new ArgumentNullException(nameof(normalizedEmail));
            }

            cancellationToken.ThrowIfCancellationRequested();

            try
            {
                IQueryable <TUser> query = AuthCloudTable.CreateQuery <TUser>()
                                           .Where(x =>
                                                  x.PartitionKey == "Users"
                                                  &&
                                                  x.NormalizedEmail == normalizedEmail);
                //fetchedUser = await query.FirstAsync(cancellationToken);
                fetchedUser = query.FirstOrDefault();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            return(fetchedUser);
        }
        public async Task <IdentityResult> UpdateAsync(TUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            cancellationToken.ThrowIfCancellationRequested();

            TableOperation executeOperation = TableOperation.Replace(user);

            try
            {
                await AuthCloudTable.ExecuteAsync(executeOperation, cancellationToken);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            return(IdentityResult.Success);
        }