public ActionResult SyncDivs()
        {
            //var viewModel = new NebsConcurrencyIndexViewModel();
            var nebsdb   = new NebsContext();
            var nebsDivs = nebsdb.NebsDivs.Where(b => b.NebsBudgetPeriodID > 5).ToList();

            nebsdb.Dispose();

            var localdb   = new ApplicationDbContext();
            var localDivs = localdb.Divs.ToList();

            localdb.Dispose();

            var localDeptsHS = new HashSet <decimal>(localDivs.Select(d => d.ID));

            using (var context = new ApplicationDbContext())
            {
                foreach (var div in nebsDivs)
                {
                    if (!localDeptsHS.Contains(div.ID))
                    {
                        context.Divs.Add(
                            new Div
                        {
                            ID             = div.ID,
                            BudgetPeriodID = div.NebsBudgetPeriodID,
                            DeptID         = div.NebsDeptID,
                            Code           = div.Code,
                            Description    = div.Description,
                            SortOrder      = div.SortOrder
                        }
                            );
                        context.SaveChanges();
                    }
                }
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult SyncBudgetPeriods()
        {
            var nebsdb            = new NebsContext();
            var nebsBudgetPeriods = nebsdb.NebsBudgetPeriods.Where(b => b.ID > 5).ToList();

            nebsdb.Dispose();

            var localdb            = new ApplicationDbContext();
            var localBudgetPeriods = localdb.BudgetPeriods.ToList();

            localdb.Dispose();

            var localBudgetPeriodsHS = new HashSet <decimal>(localBudgetPeriods.Select(d => d.ID));

            using (var context = new ApplicationDbContext())
            {
                foreach (var budgetPeriod in nebsBudgetPeriods)
                {
                    if (!localBudgetPeriodsHS.Contains(budgetPeriod.ID))
                    {
                        context.BudgetPeriods.Add(
                            new BudgetPeriod
                        {
                            ID              = budgetPeriod.ID,
                            Description     = budgetPeriod.Description,
                            ActualYear      = budgetPeriod.ActualYear,
                            WorkProgramYear = budgetPeriod.WorkProgramYear,
                            BeginYear       = budgetPeriod.BeginYear,
                            EndYear         = budgetPeriod.EndYear
                        }
                            );
                        context.SaveChanges();
                    }
                }
            }

            return(RedirectToAction("Index"));
        }