// GET: Contracts
        public async Task<ActionResult> Index()
        {
            var contracts = await db.Contracts.Include("Licenses")
                .Where(it => !it.RecLog.DeletedDate.HasValue)
                .ToListAsync();

            var userprofileRepo = new UserProfileRepository();
            var licenseIdQry = from contract in contracts
                               let licenseIds = contract.Licenses.Where(it => !it.RecLog.DeletedDate.HasValue).Select(it => it.Id.ToString()).Distinct().ToList()
                               let totalStudents = userprofileRepo
                                                        .GetUserProfileByLicenseIdInSubscription(licenseIds)
                                                        .Where(it => it.Subscriptions.Any(s => !s.DeletedDate.HasValue))
                                                        .Count()
                               select new KeyValuePair<int, int>(contract.Id, totalStudents);

            ViewBag.ContractCapacities = licenseIdQry.ToList();
            return View(contracts);
        }
        // GET: Contracts/Details/5
        public async Task<ActionResult> Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var contract = await db.Contracts.Include("Licenses").FirstAsync(it => it.Id == id.Value);
            if (contract == null)
            {
                return HttpNotFound();
            }

            var userprofileRepo = new UserProfileRepository();
            var licenseIds = contract.Licenses
                .Where(it => !it.RecLog.DeletedDate.HasValue)
                .Select(it => it.Id)
                .Select(it => new KeyValuePair<int, int>(it, userprofileRepo.GetUserProfileByLicenseIdInSubscription(it.ToString()).Count()))
                .ToList();

            ViewBag.LicenseCapacities = licenseIds;
            return View(contract);
        }