public string RecordTransactionBatch(List<Transaction> Transactions, string TransactionGroupID = "")
        {
            TransactionGroup tg = new TransactionGroup();

            if (TransactionGroupID.Equals(""))
                TransactionGroupID = System.Guid.NewGuid().ToString();

            tg.UniqueID = TransactionGroupID;

            foreach (Transaction t in Transactions)
            {
                t.TransactionBatchID = tg.UniqueID;
                context.Transaction.AddObject(Mapper.Map<Transaction, Database.Transaction>(t));
            }

            context.SaveChanges();

            return tg.UniqueID;
        }
        public string RecordTransactionBatch(List<Transaction> Transactions, string TransactionGroupID = "")
        {
            TransactionGroup tg = new TransactionGroup();

            if (TransactionGroupID.Equals(""))
                TransactionGroupID = System.Guid.NewGuid().ToString();

            tg.UniqueID = TransactionGroupID;

            using (SqlConnection conn = new SqlConnection(connStr))
            {
                conn.Open();
                SqlTransaction dbTrans=conn.BeginTransaction();

                foreach (Transaction t in Transactions)
                {
                    t.TransactionBatchID = tg.UniqueID;
                    //context.Transaction.AddObject(Mapper.Map<Transaction, DMTDataRepositories.Database.Transaction>(t));
                    conn.Execute("spTransactionRecord", TransToDynParm(t), dbTrans, commandType: CommandType.StoredProcedure);
                }

                try
                {
                    dbTrans.Commit();
                }
                catch
                {
                    Trace.WriteLine("TransactionRepo: Failed to commit batch " + tg.UniqueID);
                    tg.UniqueID = null;
                }
                finally
                {
                    dbTrans.Dispose();
                }
            }

            return tg.UniqueID;
        }