/// <summary>
        /// Add new line to the database
        /// </summary>
        /// <param name="newLine"></param>
        /// <returns>the id of this line that came from the run number in the database</returns>
        public int AddLine(BO.Line newLine)
        {
            #region Check if there is needed data on the database
            if (!dl.GetAllStations().Any(s => s.Code == newLine.FirstStation))
            {
                throw new BO.BadLineException(newLine.Id, $"Station '{newLine.FirstStation}' does not exist");
            }

            if (!dl.GetAllStations().Any(s => s.Code == newLine.LastStation))
            {
                throw new BO.BadLineException(newLine.Id, $"Station '{newLine.LastStation}' does not exist");
            }

            if (!dl.GetAllAdjacentStations().Any(s => s.Station1 == newLine.FirstStation &&
                                                 s.Station2 == newLine.LastStation))
            {
                throw new BO.BadLineException(newLine.Id,
                                              $"Missing distance and time information between {newLine.FirstStation}" +
                                              $" and {newLine.LastStation}");
            }
            #endregion

            var lineDo = newLine.CopyPropertiesToNew(typeof(DO.Line)) as DO.Line;
            return(dl.AddLine(lineDo));
        }
        /// <summary>
        /// Remove line
        /// </summary>
        /// <param name="line"></param>
        public void RemoveLine(BO.Line line)
        {
            var lineDo = line.CopyPropertiesToNew(typeof(DO.Line)) as DO.Line;

            try
            {
                dl.RemoveLine(lineDo);
            }
            catch (DO.BadLineException ex)
            {
                throw new BO.BadLineException(line.Id, ex.Message);
            }
        }
        /// <summary>
        /// Get a single line from the database
        /// build the line with a list of hes line stations
        /// </summary>
        /// <param name="lineId"></param>
        /// <returns></returns>
        public BO.Line GetLine(int lineId)
        {
            var lineBo = new BO.Line();

            try
            {
                var lineDo = dl.GetLine(lineId);
                lineDo.CopyPropertiesTo(lineBo);
                lineBo.LineStations = GetAllLineStationsByLineID(lineId);
            }
            catch (DO.BadLineException ex)
            {
                throw new BO.BadLineException(lineId, ex.Message);
            }
            catch (BO.BadLineStationException ex)
            {
                throw ex;
            }
            return(lineBo);
        }