private async Task createNewContracts(IContractRepository repo, IEnumerable <Contract> allContracts, IEnumerable <repoModel.Contract> mongoDBcontracts)
        {
            var needToCreateContracts = allContracts.Where(it => mongoDBcontracts.All(c => c.id != it.Id.ToString()));

            foreach (var efContract in needToCreateContracts)
            {
                var licenseQry = efContract.Licenses
                                 .Select(it => new repoModel.Contract.License
                {
                    id = it.Id.ToString(),
                    CourseCatalogId  = it.CourseCatalogId.ToString(),
                    CourseName       = it.CourseName,
                    CreatedDate      = it.RecLog.CreatedDate,
                    DeletedDate      = it.RecLog.DeletedDate,
                    Grade            = it.Grade,
                    StudentsCapacity = it.StudentsCapacity,
                    TeacherKeys      = it.TeacherKeys.Select(tk => new repoModel.Contract.TeacherKey
                    {
                        id          = tk.Id.ToString(),
                        Code        = tk.Code,
                        CreatedDate = tk.RecLog.CreatedDate,
                        DeletedDate = tk.RecLog.DeletedDate,
                        Grade       = tk.Grade
                    })
                });

                var contract = new repoModel.Contract
                {
                    id                    = efContract.Id.ToString(),
                    SchoolName            = efContract.SchoolName,
                    City                  = efContract.City,
                    State                 = efContract.State,
                    ZipCode               = efContract.ZipCode,
                    PrimaryContractName   = efContract.PrimaryContractName,
                    PrimaryPhoneNumber    = efContract.PrimaryPhoneNumber,
                    PrimaryEmail          = efContract.PrimaryEmail,
                    SecondaryContractName = efContract.SecondaryContractName,
                    SecondaryPhoneNumber  = efContract.SecondaryPhoneNumber,
                    SecondaryEmail        = efContract.SecondaryEmail,
                    StartDate             = efContract.StartDate,
                    ExpiredDate           = efContract.ExpiredDate,
                    TimeZone              = efContract.TimeZone,
                    CreatedDate           = efContract.RecLog.CreatedDate,
                    DeletedDate           = efContract.RecLog.DeletedDate,
                    Licenses              = licenseQry.ToList(),
                };

                await repo.UpsertContract(contract);
            }
        }
        private async Task createNewContracts(IContractRepository repo, IEnumerable<Contract> allContracts, IEnumerable<repoModel.Contract> mongoDBcontracts)
        {
            var needToCreateContracts = allContracts.Where(it => mongoDBcontracts.All(c => c.id != it.Id.ToString()));
            foreach (var efContract in needToCreateContracts)
            {
                var licenseQry = efContract.Licenses
                    .Select(it => new repoModel.Contract.License
                    {
                        id = it.Id.ToString(),
                        CourseCatalogId = it.CourseCatalogId.ToString(),
                        CourseName = it.CourseName,
                        CreatedDate = it.RecLog.CreatedDate,
                        DeletedDate = it.RecLog.DeletedDate,
                        Grade = it.Grade,
                        StudentsCapacity = it.StudentsCapacity,
                        TeacherKeys = it.TeacherKeys.Select(tk => new repoModel.Contract.TeacherKey
                        {
                            id = tk.Id.ToString(),
                            Code = tk.Code,
                            CreatedDate = tk.RecLog.CreatedDate,
                            DeletedDate = tk.RecLog.DeletedDate,
                            Grade = tk.Grade
                        })
                    });

                var contract = new repoModel.Contract
                {
                    id = efContract.Id.ToString(),
                    SchoolName = efContract.SchoolName,
                    City = efContract.City,
                    State = efContract.State,
                    ZipCode = efContract.ZipCode,
                    PrimaryContractName = efContract.PrimaryContractName,
                    PrimaryPhoneNumber = efContract.PrimaryPhoneNumber,
                    PrimaryEmail = efContract.PrimaryEmail,
                    SecondaryContractName = efContract.SecondaryContractName,
                    SecondaryPhoneNumber = efContract.SecondaryPhoneNumber,
                    SecondaryEmail = efContract.SecondaryEmail,
                    StartDate = efContract.StartDate,
                    ExpiredDate = efContract.ExpiredDate,
                    TimeZone = efContract.TimeZone,
                    CreatedDate = efContract.RecLog.CreatedDate,
                    DeletedDate = efContract.RecLog.DeletedDate,
                    Licenses = licenseQry.ToList(),
                };

                await repo.UpsertContract(contract);
            }
        }