public ActionResult Create(TransactionRest transaction)
        {
            using (var db = DbFactory.Open())
            {
                var dlTransaction = TransactionFromRest(transaction, db);
                db.Session.Save(dlTransaction);
                db.Session.Save(NotificationCreator.ForCreatedTransaction(dlTransaction));
                db.Commit();

                var response = new TransactionRest(dlTransaction);
                Logger.I("Created transaction {0}", response.ToJson());
                return Json(response);
            }
        }
        public ActionResult Update(TransactionRest transaction)
        {
            if (!transaction.Id.HasValue)
            {
                Logger.I("Attempt to update transaction without id");
                Response.StatusCode = 400;
                return Json(new { Field = "Id", Message = "Missing Id" });
            }

            using (var db = DbFactory.Open())
            {
                var oldTransaction = db.Load<Transaction>(transaction.Id.Value);
                var newTransaction = TransactionFromRest(transaction, db);
                db.Session.Save(NotificationCreator.ForUpdatedTransaction(oldTransaction, newTransaction));

                db.Session.Update(TransactionFromRest(transaction, db, oldTransaction));
                db.Commit();

                var response = new TransactionRest(newTransaction);
                Logger.I("Updated transaction {0}", response.ToJson());
                return Json(response);
            }
        }