public async Task <Transaction> GetTransaction(string id) { Transaction transaction; try { transaction = await TransactionRepository.GetById(id); if (transaction == null) { transaction = await BlockchainDataProvider.GetTransaction(id); if (transaction != null) { await BlockService.GetBlock(transaction.Blockhash); foreach (var asset in transaction.Assets) { var assetExists = await AssetRepository.Exists(asset.Id); if (!assetExists && !String.IsNullOrWhiteSpace(asset.MetadataUrl)) { var assetData = await BlockchainDataProvider.GetMetadataContent(new Uri(asset.MetadataUrl)); await AssetRepository.Save(assetData); } } await TransactionRepository.Save(transaction); } } } catch (Exception ex) { await Log.WriteError(this.GetType().ToString(), "GetTransaction", $"transaction_id:{id}", ex, DateTime.Now); return(null); } return(transaction); }