static public bool AddTimetable(string name, List <Station> newStations, List <StationTime> newStationTimes, List <int> newDays)
        {
            Train train = trains.Find(x => x.ToString().ToLower() == name.ToLower());

            if (train != null)
            {
                TrainPath newTrainPath = new TrainPath();
                newTrainPath.Stations = newStations.Select(x => x.StationID).ToList <int>();
                TrainPath old = trainPaths.Find(x => Enumerable.SequenceEqual(x.Stations, newTrainPath.Stations));
                int       pathID;
                if (old != null)
                {
                    pathID = old.PathID;
                }
                else
                {
                    newTrainPath.PathID = trainPaths.Count + 1;
                    pathID = newTrainPath.PathID;
                    trainPaths.Add(newTrainPath);
                    var outputTrainPath = JsonConvert.SerializeObject(trainPaths);
                    File.WriteAllText(TrainpathsFile, outputTrainPath);
                }
                Timetable newTimetable = new Timetable();
                newTimetable.TrainID = train.TrainID;
                newTimetable.PathID  = pathID;
                newTimetable.Hours   = newStationTimes;
                newTimetable.Days    = newDays;
                timetable.Add(newTimetable);
                var outputTimetable = JsonConvert.SerializeObject(timetable);
                File.WriteAllText(TimetablesFile, outputTimetable);
                train.PathIDs.Add(pathID);
                var outputTrain = JsonConvert.SerializeObject(trains);
                File.WriteAllText(TrainsFile, outputTrain);
                return(true);
            }
            return(false);
        }
        static public Timetable FindTrainDetails(string trainName, string routeName)
        {
            Train train = trains.Find(x => x.TrainName.ToLower() == trainName.ToLower());

            if (train != null)
            {
                List <TrainPath> paths = trainPaths.FindAll(x => train.PathIDs.Contains(x.PathID));
                if (paths.Count > 0)
                {
                    string startStation, endStation;
                    try
                    {
                        startStation = routeName.Split('-')[0].Trim();
                        endStation   = routeName.Split('-')[1].Trim();
                    }
                    catch (Exception e)
                    {
                        return(null);
                    }
                    int startStationID = stations.Find(x => x.StationName.ToLower() == startStation.ToLower()).StationID;
                    int endStationID   = stations.Find(x => x.StationName.ToLower() == endStation.ToLower()).StationID;
                    if (startStationID > 0 && endStationID > 0)
                    {
                        TrainPath path = paths.Find(x => x.Stations[0] == startStationID && x.Stations[x.Stations.Count - 1] == endStationID);
                        if (path != null)
                        {
                            Timetable result = timetable.Find(x => x.TrainID == train.TrainID && x.PathID == path.PathID);
                            if (result != null)
                            {
                                return(result);
                            }
                        }
                    }
                }
            }
            return(null);
        }