public long RegisterKey(ActivationKeyCreateModel model, string createdBy)
        {
            var intention = this.FindIntentionById(model.IntentionId);

            var key = new ActivationKey()
            {
                CreatedBy   = createdBy,
                Name        = model.Name,
                IntentionId = intention.Id,
                Intention   = intention
            };

            this.Data.ActivationKeyRepository.Add(key);
            this.Data.SaveChanges();

            return(intention.Id);
        }
        public ActionResult Create([Bind(Include = "Name,IntentionId")] ActivationKeyCreateModel model)
        {
            try
            {
                if (this.ModelState.IsValid)
                {
                    var id = this._activationKeyService.RegisterKey(model, this.User.Identity.Name);

                    //return RedirectToAction("Details", new { id = id });
                    return(RedirectToAction("Details", "Intention", new { id = model.IntentionId }));
                }

                return(View(model));
            }
            catch (NotFoundException ex)
            {
                return(HttpNotFound(ex.Message));
            }
        }