public static void deleteByNames()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("DELETE A RECORD" + Environment.NewLine);

            //Call a method to read from the list of all records
            RecordList recordsList = MarinaTools.readList();


            Console.WriteLine("In order to delete your booking we need you to input some information: " + Environment.NewLine);
            Console.ForegroundColor = ConsoleColor.White;

            bool   repeat;
            string oName, bName;


            do
            {
                Console.WriteLine("Name of the owner > ");
                oName  = Console.ReadLine();
                repeat = MarinaTools.checkStringInput(oName);
            } while (repeat == true);

            do
            {
                Console.WriteLine("Name of the boat > ");
                bName  = Console.ReadLine();
                repeat = MarinaTools.checkStringInput(bName);
            } while (repeat == true);

            //find the records that contain the inserted owner name and owner boat
            IEnumerable <RecordNode> delList = recordsList.Where(record => (record.getName() == oName) && (record.getBoat() == bName));

            if (delList.Count() != 0)
            {
                Console.WriteLine(String.Join(Environment.NewLine, delList));


                Console.WriteLine("Insert the position number that you want to delete >");

                string inputNumber;

                do
                {
                    inputNumber = Console.ReadLine();
                }while (repeat == true);

                int delNumber = int.Parse(inputNumber);

                finalDelCheck(delNumber, recordsList);
            }
            else
            {
                Console.WriteLine("The entered details have 0 matches. Press enter to go back to the main menu.");
                MarinaTools.goBackMainMenu();
            }
        }
        public static void deleteRecord(int number, RecordList list)         // removes a record from the list and displays the boats that have to be moved in the holding bay
        {
            int count    = list.Count();
            int movments = count - number - 1;
            IEnumerable <RecordNode> movList = list.Where(record => (record.getPosition() > number));

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("DELETE A RECORD" + Environment.NewLine);
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("The record has been succesfully deleted." + Environment.NewLine);

            if (movList.Count() != 0)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("In order to leave access out to that boat, you have to move in the holding bay the following " + movments + " boat/s:" + Environment.NewLine);
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(String.Join(Environment.NewLine, movList));
            }
            else
            {
                Console.WriteLine("There is no need to move any other boat to leave access out to this one.");
            }
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(Environment.NewLine + "Press enter to go back to the main menu.");

            list.removeRecordAt(number);

            if (list.EmptyCheck() != 0)             // check if the list is empty
            {
                MarinaTools.writeList(list);
            }
            else
            {
                MarinaTools.writeEmptyList();                   //if the last record has been removed, clear all the text in the file. Using the binary formatter in this case, leaves some strings in the file that interfer with the creation of new records.
            }


            MarinaTools.goBackMainMenu();
        }