public JsonResult Update([DataSourceRequest] DataSourceRequest request, License license)
        {
            if (license != null && ModelState.IsValid)
            {
                LicenseRepository.Update(license);
            }

            return Json(ModelState.ToDataSourceResult());
        }
        public JsonResult Create([DataSourceRequest] DataSourceRequest request, License license)
        {
            if (license != null && ModelState.IsValid)
            {
                LicenseRepository.Insert(license);
            }

            return Json(new[] { license }.ToDataSourceResult(request, ModelState));
        }
        public static  void Insert(License license)
        {
            var last = Licenses.LastOrDefault();

            license.LicenseId = last != null ? last.LicenseId + 1 : 1;
            
            Licenses.Add(license);

            HttpContext.Current.Session["Licenses"] = Licenses;
        }
        public static void Update(License license)
        {
            var old = Licenses.Where(l => l.LicenseId == license.LicenseId).FirstOrDefault();

            if (old != null)
            {
                old.CustomerId = license.CustomerId;
                old.VendorId = license.VendorId;
                old.ProductId = license.ProductId;
            }

            HttpContext.Current.Session["Licenses"] = Licenses;
        }