public async Task ApplyClaimDefinitionAsync(string userId, Guid claimDefinitionId)
        {
            var claimDefinition = await _dbContext.ClaimDefinitions.Include(p => p.CredentialSchema).FirstOrDefaultAsync(p => p.Id == claimDefinitionId);

            var issuerWalletData = await GetDefaultWalletDataAsync(claimDefinition.UserId);

            var issuerWallet = await Wallet.OpenWalletAsync(issuerWalletData.Name, null, null);

            var userWalletData = await GetDefaultWalletDataAsync(userId);

            var userWallet = await Wallet.OpenWalletAsync(userWalletData.Name, null, null);

            var schemaCreatorWalletData = await GetDefaultWalletDataAsync(claimDefinition.CredentialSchema.UserId);


            try
            {
                using (var pool = await PoolUtils.CreateAndOpenPoolLedgerAsync())
                {
                    var userIssuerDidResult = await Did.CreateAndStoreMyDidAsync(userWallet, "{}");

                    var schema = await GetSchemaAsync(pool, issuerWalletData.Did, schemaCreatorWalletData.Did, claimDefinition.CredentialSchema.Name, claimDefinition.CredentialSchema.Version);

                    var transcriptClaimOfferJson = await AnonCreds.IssuerCreateClaimOfferAsync(issuerWallet, schema.GetValue("result").ToString(), issuerWalletData.Did, userIssuerDidResult.Did);

                    await AnonCreds.ProverStoreClaimOfferAsync(userWallet, transcriptClaimOfferJson);

                    var userMasterSecretName = RandomUtils.RandomString(8);
                    await AnonCreds.ProverCreateMasterSecretAsync(userWallet, userMasterSecretName);

                    var getClaimDefRequest = await Ledger.BuildGetClaimDefTxnAsync(userIssuerDidResult.Did, schema.GetValue("result").Value <int>("seqNo"), "CL", issuerWalletData.Did);

                    var getClaimDefResponse = await Ledger.SubmitRequestAsync(pool, getClaimDefRequest);

                    var transcriptClaimDef = JObject.Parse(getClaimDefResponse).GetValue("result");

                    var transcriptClaimRequestJson = await AnonCreds.ProverCreateAndStoreClaimReqAsync(userWallet, userIssuerDidResult.Did, transcriptClaimOfferJson, transcriptClaimDef.ToString(), userMasterSecretName);

                    var userIndyClaim = new UserIndyClaim
                    {
                        ClaimDefinitionId = claimDefinitionId,
                        ClaimRequest      = transcriptClaimRequestJson,
                        Id          = Guid.NewGuid(),
                        LastUpdated = DateTime.UtcNow,
                        Status      = UserIndyClaimStatus.Requested,
                        TimeCreated = DateTime.UtcNow,
                        UserId      = userId
                    };

                    _dbContext.UserIndyClaims.Add(userIndyClaim);
                    await _dbContext.SaveChangesAsync();
                }
            }
            finally
            {
                await userWallet.CloseAsync();

                await issuerWallet.CloseAsync();
            }
        }