private static void BulkDelete(EntitiesModel context)
        {
            // avoid showing the INSERT statements that populate the data
            context.Log = null;

            for (int i = 0; i < 10; i++)
            {
                Car car = new Car() { Make = "BMW", Model = "1020", CarYear = 2018, Available = true, CategoryID = 1, TagNumber = i.ToString()};
                context.Add(car);
            }
            context.SaveChanges();

            // show the delete statements
            context.Log = Console.Out;

            var query = context.GetAll<Car>().Where(c => c.CarYear > DateTime.Now.Year);
            int deleted = query.DeleteAll();
            Console.WriteLine("Deleted cars: {0}", deleted);
        }
        private static void BulkUpdate(EntitiesModel context)
        {
            string tooOldName = "Too old";
            Category tooOldCategory = context.Categories.FirstOrDefault(c => c.CategoryName == tooOldName);
            if (tooOldCategory == null)
            {
                tooOldCategory = new Category();
                tooOldCategory.CategoryName = tooOldName;
                context.Add(tooOldCategory);
                context.SaveChanges();
            }

            var query = context.GetAll<Car>().Where(c => c.CarYear < 2000);

            int updated = query.UpdateAll(u => u.Set(c => c.Category, c => tooOldCategory)
                                                .Set(c => c.Available, c => false));

            Console.WriteLine("Updated cars: {0}", updated);
        }