public async Tasks.Task <JsonResult> CreateAsync([Bind(Include = "Name, Description, Priority, DueDate, CategoryId")] TaskJsonViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Json(GetModel(ModelState), JsonRequestBehavior.AllowGet));
                }

                var result = await TaskManager.AddAsync(model.ToDataModel());

                return(result.ValidationResults.HasErrors() ?
                       Json(GetModel(result.ValidationResults), JsonRequestBehavior.AllowGet) :
                       Json(GetModel(result.Id.Value), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(GetModel(ex), JsonRequestBehavior.AllowGet));
            }
        }