public JsonResult CreateItem(ItemModel model)
        {
            if (!ModelState.IsValid)
            {
                return Json(new
                {
                    Result = "ERROR",
                    Message = "Form is not valid! " +
                    "Please correct it and try again."
                });
            }

            if (!User.Identity.IsAuthenticated)
            {
                return Json(new
                {
                    Result = "ERROR",
                    Message = "You need to log in to add an item."
                });
            }

            if (!User.IsInRole("Officer"))
            {
                return Json(new
                {
                    Result = "ERROR",
                    Message = "You do not have the authority to create a new inventory item."
                });
            }
            try
            {
                JourListDMContainer dm = new JourListDMContainer();

                StandardItem item = new StandardItem();

                item.Description = model.Description;
                //if (model.Hyperlink != null) item.Hyperlink = model.Hyperlink;
                //if (model.Barcode != null) item.Barcode = model.Barcode;
                item.ItemCategory = dm.ItemCategories.Single(z => z.Id == model.CategoryId);
                item.UnitType = dm.UnitTypes.Single(z => z.Id == model.UnitTypeId);

                dm.AddToItems(item);
                dm.SaveChanges();

                model.Id = item.Id;

                return Json(new { Result = "OK", Record = model });
            }
            catch (Exception e)
            {
                return Json(new { Result = "ERROR", Message = e.Message });
            }
        }
 /// <summary>
 /// Create a new StandardItem object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static StandardItem CreateStandardItem(global::System.Int64 id, global::System.String description)
 {
     StandardItem standardItem = new StandardItem();
     standardItem.Id = id;
     standardItem.Description = description;
     return standardItem;
 }