//Todo: Clean this up
        public IEnumerable<Route> Convert(string XML, string parentNodeName)
        {
			if (string.IsNullOrEmpty (XML) || string.IsNullOrEmpty (parentNodeName)) {
				throw new ArgumentNullException ();
			}

            var parsedXML = XDocument.Parse(XML);

			var routeXelement = parsedXML.Descendants ().Where (x => x.Name == "route").Single();
			var trainsXelements = routeXelement.Descendants().Where(x => x.Name == "train");

			Route route = new Route ();
			var lineName = XMLParsingTools.ExtractAttribute (routeXelement, "name"); 

			route.TrainRoute = RouteHelper.GetTrainRouteEnum (lineName);

            List<Train> parsedTrains = new List<Train>();
			foreach (XElement train in trainsXelements)
            {
				var newTrain = new Train(route)
                {
                    DestinationName = XMLParsingTools.ExtractValue(train, "destNm"),
                    RunNumber = XMLParsingTools.ParseUShort(XMLParsingTools.ExtractValue(train, "rn")),
                    DestinationStopNumber = XMLParsingTools.ParseUShort(XMLParsingTools.ExtractValue(train, "destSt")),
                    IsApproaching = XMLParsingTools.ParseBool(XMLParsingTools.ExtractValue(train, "isApp")),
                    IsDelayed = XMLParsingTools.ParseBool(XMLParsingTools.ExtractValue(train, "isDly")),
                    HeadingDegrees = XMLParsingTools.ParseInt(XMLParsingTools.ExtractValue(train, "heading")),
                    TrainLongitude = XMLParsingTools.ParseDecimal(XMLParsingTools.ExtractValue(train, "lon")),
                    TrainLatitude = XMLParsingTools.ParseDecimal(XMLParsingTools.ExtractValue(train, "lat")),
                    TrainDirection = XMLParsingTools.ParseInt(XMLParsingTools.ExtractValue(train, "trDr")),
                    PredicationGeneratedTime = XMLParsingTools.PraseDateTime(XMLParsingTools.ExtractValue(train, "prdt")),
                    PredicatedArrival = XMLParsingTools.PraseDateTime(XMLParsingTools.ExtractValue(train, "arrT")),
                    NextStationID = XMLParsingTools.ParseUShort(XMLParsingTools.ExtractValue(train, "nextStaId")),
                    NextStopID = XMLParsingTools.ParseUShort(XMLParsingTools.ExtractValue(train, "nextStpId")),
                    NextStationName = XMLParsingTools.ExtractValue(train, "nextStaNm"),
                    Flags = XMLParsingTools.ExtractValue(train, "flags")
                };

                //newTrain.Route = route;
                parsedTrains.Add(newTrain);

            }

			route.Trains = parsedTrains;

			return new Route[] { route };
        }
        public IEnumerable <ETA> Convert(string XML, string parentNodeName)
        {
            if (string.IsNullOrEmpty(XML) || string.IsNullOrEmpty(parentNodeName))
            {
                throw new ArgumentNullException();
            }

            var parsedXML  = XDocument.Parse(XML);
            var parentNode = parsedXML.Descendants().Where(x => x.Name == parentNodeName);
            var etas       = parentNode.SelectMany(x => x.Descendants().Where(y => y.Name == "eta"));


            List <ETA> parsedETA = new List <ETA>();

            foreach (XElement eta in etas)
            {
                parsedETA.Add(new ETA()
                {
                    PredicatedArrival    = XMLParsingTools.PraseDateTime(XMLParsingTools.ExtractValue(eta, "arrT")),
                    DestinationName      = XMLParsingTools.ExtractValue(eta, "destNm"),
                    DestinationStationID = XMLParsingTools.ParseUShort(XMLParsingTools.ExtractValue(eta, "destSt")),
                    Flags                    = XMLParsingTools.ExtractValue(eta, "flags"),
                    IsApproaching            = XMLParsingTools.ParseBool(XMLParsingTools.ExtractValue(eta, "isApp")),
                    IsDelayed                = XMLParsingTools.ParseBool(XMLParsingTools.ExtractValue(eta, "isDly")),
                    IsFaultDetected          = XMLParsingTools.ParseBool(XMLParsingTools.ExtractValue(eta, "isFlt")),
                    IsLivePrediction         = XMLParsingTools.ParseBool(XMLParsingTools.ExtractValue(eta, "isSch")),
                    PredicationGeneratedTime = XMLParsingTools.PraseDateTime(XMLParsingTools.ExtractValue(eta, "prdt")),
                    RunNumber                = XMLParsingTools.ParseInt(XMLParsingTools.ExtractValue(eta, "rn")),
                    RouteName                = XMLParsingTools.ExtractValue(eta, "rt"),
                    StationID                = XMLParsingTools.ParseUShort(XMLParsingTools.ExtractValue(eta, "staId")),
                    StationName              = XMLParsingTools.ExtractValue(eta, "staNm"),
                    StationDescription       = XMLParsingTools.ExtractValue(eta, "stpDe"),
                    StopID                   = XMLParsingTools.ParseInt(XMLParsingTools.ExtractValue(eta, "stpId")),
                    RouteDirectionCode       = XMLParsingTools.ParseInt(XMLParsingTools.ExtractValue(eta, "trDr")),
                });
            }

            return(parsedETA);
        }