public async Task UpsertAsync(Transaction transaction, TransactionReceipt receipt, bool failed, HexBigInteger timeStamp, bool hasVmStack = false, string error = null)
        {
            using (var context = _contextFactory.CreateContext())
            {
                BlockchainStore.Entities.Transaction tx = await FindOrCreate(transaction, context).ConfigureAwait(false);

                tx.Map(transaction);
                tx.Map(receipt);

                tx.Failed     = failed;
                tx.TimeStamp  = (long)timeStamp.Value;
                tx.Error      = error ?? string.Empty;
                tx.HasVmStack = hasVmStack;

                tx.UpdateRowDates();

                if (tx.IsNew())
                {
                    context.Transactions.Add(tx);
                }
                else
                {
                    context.Transactions.Update(tx);
                }

                await context.SaveChangesAsync().ConfigureAwait(false);
            }
        }
        public async Task UpsertAsync(string contractAddress, string code, Transaction transaction, TransactionReceipt receipt, bool failedCreatingContract, HexBigInteger blockTimestamp)
        {
            using (var context = _contextFactory.CreateContext())
            {
                BlockchainStore.Entities.Transaction tx = await FindOrCreate(transaction, context).ConfigureAwait(false);

                tx.Map(transaction);
                tx.Map(receipt);

                tx.NewContractAddress = contractAddress;
                tx.Failed             = false;
                tx.TimeStamp          = (long)blockTimestamp.Value;
                tx.Error      = string.Empty;
                tx.HasVmStack = false;

                tx.UpdateRowDates();

                if (tx.IsNew())
                {
                    context.Transactions.Add(tx);
                }
                else
                {
                    context.Transactions.Update(tx);
                }

                await context.SaveChangesAsync().ConfigureAwait(false);
            }
        }