private static bool ExistingVoucher(Voucher voucher)
        {
            if (voucher == null)
            {
                Console.WriteLine("You must create a voucher first (n for new voucher)");
                return false;
            }

            return true;
        }
        private static void ActivateVoucher(Voucher voucher)
        {
            if (!ExistingVoucher(voucher)) return;

            voucher.Activate();
        }
        private static void SaveVoucher(Voucher voucher, ISessionFactory sessionFactory)
        {
            if (!ExistingVoucher(voucher)) return;

            using (var session = sessionFactory.OpenSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    while (string.IsNullOrEmpty(voucher.VoucherCode))
                    {
                        Console.WriteLine("Enter Voucher code");
                        voucher.VoucherCode = Console.ReadLine();
                    }session.SaveOrUpdate(voucher);
                    transaction.Commit();
                }
            }
        }
            public override void Redeem(Voucher voucher)
            {
                voucher.SetVoucherState(Redeemed);

                // Mark As Finished
                voucher.MarkAsFinished();
            }
        private static void RedeemVoucher(Voucher voucher)
        {
            if (!ExistingVoucher(voucher)) return;

            voucher.Redeem();
        }
 public override void PreRedeem(Voucher voucher)
 {
     voucher.SetVoucherState(Preredeemed);
 }
 public virtual void Redeem(Voucher voucher)
 {
     InvalidTransition(Redeemed);
 }
 public virtual void PreRedeem(Voucher voucher)
 {
     InvalidTransition(Preredeemed);
 }
 public virtual void Activate(Voucher voucher)
 {
     InvalidTransition(Activated);
 }
 public override void Activate(Voucher voucher)
 {
     voucher.SetVoucherState(Activated);
 }