private static async Task <string> GetPrivateKey(ISigningServiceApi signingServiceApi, string address)
 {
     try
     {
         return((await signingServiceApi.GetPrivateKey(address)).PrivateKey);
     }
     catch (Exception e)
     {
         Console.WriteLine(
             $"Private key for address {address} is not found. Error - {e.Message + e.StackTrace}");
         return(null);
     }
 }
        private static async Task Migrate(IBlockchainWalletsRepository walletRepository, ISigningServiceApi signingServiceApi,
                                          IBlockchainSignFacadeClient blockchainSignFacade, ICqrsEngine cqrs,
                                          IBcnCredentialsRecord bcnCredentialsRecord)
        {
            var clientId       = Guid.Parse(bcnCredentialsRecord.ClientId);
            var existingWallet = await walletRepository.TryGetAsync(BlockchainType, clientId);

            if (existingWallet != null)
            {
                return;
            }
            var address    = bcnCredentialsRecord.AssetAddress;
            var privateKey = await GetPrivateKey(signingServiceApi, address);

            if (privateKey == null)
            {
                return;
            }

            await ImportWalletToSignFacade(blockchainSignFacade, privateKey, address);

            await walletRepository.AddAsync(BlockchainType, clientId, address, CreatorType.LykkeWallet);

            var @event = new WalletCreatedEvent
            {
                Address            = address,
                AssetId            = AssetId,
                BlockchainType     = BlockchainType,
                IntegrationLayerId = BlockchainType,
                ClientId           = clientId,
                CreatedBy          = CreatorType.LykkeWallet
            };

            cqrs.PublishEvent(@event, BlockchainWalletsBoundedContext.Name);
        }