private StateTransaction CheckSkuBlockHashAndTxIndex(string skuBlockHash, int skuTxIndex, TransactionAction expectedTxAction, string netId) { try { var block = _blockchainRepository.GetBlockByHash(skuBlockHash, netId); var transaction = block.Transactions.ToList()[skuTxIndex]; if (transaction.Action != expectedTxAction.ToString()) { throw new TransactionRejectedException("Invalid transaction action in SkuBlock. Expected action: " + expectedTxAction.ToString()); } return((StateTransaction)transaction); } catch (KeyNotFoundException e) { throw new TransactionRejectedException(e.Message); } catch (IndexOutOfRangeException) { throw new TransactionRejectedException("SKU transaction does not exist in SkuBlock"); } }