public ActionResult CreateReservation([Bind] Wish wish)
        {
            var existing = wishRepository.GetByPrimaryKey(wish.Id);

            if (existing.Reserved + wish.Reserved > existing.Amount)
            {
                throw new Exception("Amount reserved exceeds amount wanted");
            }
            existing.Reserved += wish.Reserved;
            existing.IP        = Request.UserHostAddress;
            wishRepository.Update(existing);
            return(View());
        }
        public Task <bool> Handle(UpdateWishCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.FromResult(false));
            }

            var wish = new Wish(message.Id, message.UserId);

            _wishRepository.Update(wish);

            if (Commit())
            {
                Bus.RaiseEvent(new WishUpdatedEvent(wish.Id, wish.UserId));
            }

            return(Task.FromResult(true));
        }