// Problem 16 - Remove Towns
        private static void RemoveTown(SoftUniContext context)
        {
            Console.Write("Town: ");
            string town = Console.ReadLine();

            var townToRemove = context.Towns.FirstOrDefault(t => t.Name == town);

            if (townToRemove == null)
            {
                return;
            }

            int count     = townToRemove.Addresses.Count;
            var addresses = townToRemove.Addresses.ToList();

            foreach (var address in addresses)
            {
                var employees = context.Employees.Where(e => e.AddressID == address.AddressID);
                foreach (var employee in employees)
                {
                    employee.AddressID = null;
                    employee.Address   = null;
                }

                context.Addresses.Remove(address);
            }

            context.Towns.Remove(townToRemove);

            context.SaveChanges();

            string addressStr = count == 1 ? "address" : "addresses";
            string isStr      = count == 1 ? "was" : "were";

            Console.WriteLine($"{count} {addressStr} in {town} {isStr} deleted");
        }
        public static void Main(string[] args)
        {
            SoftUniContext context = new SoftUniContext();

            CompareNativeQueryAndLinq();
        }