private void AddTagsToCurrentLine(ILineInterface currentLine, List <ITag> tags)
        {
            IStationInterface           previousStation;
            IStationInterface           currentStation           = null;
            IStationConnectionInterface currentStationConnection = null;
            List <IStationInterface>    stations = new List <IStationInterface>();

            foreach (ITag tag in tags)
            {
                switch (tag.TagType)
                {
                case DataEnums.STATION:
                    previousStation = currentStation;
                    IStationInterface tempStation = ParseStation(tag.Value);
                    currentStation = StationAlreadyInList(tempStation)
                            ? GetStation(tempStation.Name)
                            : tempStation;

                    stations.Add(currentStation);

                    ConnectStations(currentStation, previousStation, currentStationConnection);
                    currentStationConnection = null;
                    break;

                case DataEnums.TIME:
                    currentStationConnection = ParseStationConnection(tag.Value);
                    break;
                }
            }
            currentLine.Stations = stations.ToArray();
        }
 private IStationConnectionInterface[] GetStationArray(IStationInterface station)
 {
     IStationConnectionInterface[] stationConnections = new IStationConnectionInterface[1];
     if (station.StationConnections?.Length > 0)
     {
         stationConnections = new IStationConnectionInterface[station.StationConnections.Length + 1];
         station.StationConnections.CopyTo(stationConnections, 0);
     }
     return(stationConnections);
 }
        private void ConnectStations(IStationInterface firstStation, IStationInterface secondStation, IStationConnectionInterface connection)
        {
            if (firstStation != null && secondStation != null && connection != null)
            {
                IStationConnectionInterface[] stationConnections = GetStationArray(firstStation);
                stationConnections[stationConnections.Length - 1] =
                    new StationConnectionModel(
                        hours: connection.Hours,
                        minutes: connection.Minutes,
                        station: secondStation);
                firstStation.StationConnections = stationConnections;

                stationConnections = GetStationArray(secondStation);
                stationConnections[stationConnections.Length - 1] =
                    new StationConnectionModel(
                        hours: connection.Hours,
                        minutes: connection.Minutes,
                        station: firstStation);
                secondStation.StationConnections = stationConnections;
            }
        }