public ParkingSpot AddNewParkingEntry(string registrationNumber) { var freeParkingSpots = _parkingRepository.GetNumberOfFreeParkingSpots().GetAwaiter().GetResult(); if (freeParkingSpots == 0) { Console.WriteLine("We are sorry! There are no avaiable parking places at the moment.\n"); return(null); } if (!IsRegistrationNumberValid(registrationNumber)) { Console.WriteLine("Wrong format of registration number! Please try again.\n"); return(null); } if (_parkingRepository.GetParkingCarByRegistrationNumber(registrationNumber).GetAwaiter().GetResult() != null) { Console.WriteLine("There is already a car with this registration number. Please try again. \n"); return(null); } var parkingSpot = _parkingRepository.AddNewParkingEntry(registrationNumber).GetAwaiter().GetResult(); Console.WriteLine($"You have left your car on number {parkingSpot.ParkingSpotNumber}.\n"); return(parkingSpot); }