public void SearchRoute(object args)
        {
            _updateInformationAboutSearching = ((SearchRouteArgs)args).DelegateToUpdatingInformationAboutSearching;
            _updateInformationAboutSearching("Searching direct connection", 0);
            Delegates.DeliverResults deliverResults = ((SearchRouteArgs)args).DelegateToDeliverResultsToView;

            List<SearchResultConnection> result = new List<SearchResultConnection>();

            SoughtConnection soughtConnection = ((SearchRouteArgs)args).UserSearchArgs.SoughtConnectionByUser;
            SearcherOfDirectRoutes searcherDirectRoutes = new SearcherOfDirectRoutes();
            SearchResultConnection directConnection = searcherDirectRoutes.FindDirectConnection(_repository, soughtConnection);
            if (directConnection != null)
            {
                result.Add(directConnection);
                deliverResults(result);
                result.Remove(directConnection);
            }

            if (((SearchRouteArgs)args).UserSearchArgs.ShouldSearchOnlyDirectConnections)
            {
                if (directConnection == null)
                {
                    _updateInformationAboutSearching("No results", 100);
                }
                else
                {
                    _updateInformationAboutSearching("Searching done", 100);
                }
                return;
            }
            _updateInformationAboutSearching("Searching indirect connection", 10);
            SearcherOfIndirectRoutes searcherOfIndirectRoutes = new SearcherOfIndirectRoutes();
            List<SearchResultConnection> indirectConnection = searcherOfIndirectRoutes.FindIndirectConnection(_repository, soughtConnection, _processInformationAboutIndirectSearchingAndDeliverToTheView);
            if (indirectConnection == null)
            {
                if (directConnection == null)
                {
                    _updateInformationAboutSearching("No results", 100);
                }
                else
                {
                    _updateInformationAboutSearching("Searching done", 100);
                }
                return;
            }
            result.AddRange(indirectConnection);
            deliverResults(result);

            if (directConnection == null && (indirectConnection == null || indirectConnection.Count == 0))
            {
                _updateInformationAboutSearching("No results", 100);
            }
            else
            {
                _updateInformationAboutSearching("Searching done", 100);
            }
        }
        private List<SingleBusStopForIndirectConnection> FindBusStopsWithLinesWhichAreCloseToTheTarget(Repository repository, SoughtConnection soughtConnection, Delegates.UpdateInformationAboutProgresForTheUser updateInformationForUserAboutSearching)
        {
            SearcherOfDirectRoutes searcherOfDirectConnections = new SearcherOfDirectRoutes();
            List<SingleBusStopForIndirectConnection> busStopsToCheckList = InitializeBusStopsToCheckList(soughtConnection, repository.BusStops);
            List<SingleBusStopForIndirectConnection> busStopsCheckedList = new List<SingleBusStopForIndirectConnection>();

            string busStopNameStopCondition = "";
            NeighbourBusStopsRecognizer.Direction direction;
            if (soughtConnection.IsDeparture)
            {
                busStopNameStopCondition = soughtConnection.EndBusStop;
                direction = NeighbourBusStopsRecognizer.Direction.Next;
            }
            else
            {
                busStopNameStopCondition = soughtConnection.StartBusStop;
                direction = NeighbourBusStopsRecognizer.Direction.Previous;
            }

            // lastBusStop is (only in the first step)
            // - start bus stop for departure
            // - end bus stop for arrival
            SingleBusStopForIndirectConnection lastBusStop = busStopsToCheckList.Last();
            busStopsToCheckList.RemoveAt(busStopsToCheckList.Count - 1);
            busStopsCheckedList.Add(lastBusStop);
            int numberOfAllBusStopsToCheck = busStopsToCheckList.Count;
            TimeOfArrival maxWaitingTime = new TimeOfArrival(2, 0);
            do
            {
                double actualProgress = (double)busStopsCheckedList.Count / (double)numberOfAllBusStopsToCheck;
                updateInformationForUserAboutSearching(actualProgress);
                DateTime dateTomeForRecognizerOfNeighbourBusStops = new DateTime();
                if (soughtConnection.IsDeparture)
                {
                    dateTomeForRecognizerOfNeighbourBusStops = lastBusStop.ArrivalDateTimeAtThisBusStopForDepartureOrAtTheNextBusStopForArrival;
                }
                else
                {
                    dateTomeForRecognizerOfNeighbourBusStops = lastBusStop.DepartureDateTimeFromPreviousBusStopForDepartureOrFromCurrentBusStopForArrival;
                }
                List<string> neighbourBusStopsList = new NeighbourBusStopsRecognizer().RecognizeNeighbourBusStopsInSpecifiedDirection(lastBusStop.BusStopName,
                    repository, dateTomeForRecognizerOfNeighbourBusStops, direction);
                foreach (SingleBusStopForIndirectConnection oneBusStop in busStopsToCheckList)
                {
                    bool oneBusStopWasFound = false;

                    foreach (string neighbourBusStop in neighbourBusStopsList)
                    {
                        if (neighbourBusStop.Equals(oneBusStop.BusStopName))
                        {
                            oneBusStopWasFound = true;
                            break;
                        }
                    }

                    if (!oneBusStopWasFound)
                    {
                        continue;
                    }
                    SoughtConnection singleSoughtConnection = null;
                    if (soughtConnection.IsDeparture)
                    {
                        singleSoughtConnection = new SoughtConnection(lastBusStop.BusStopName, oneBusStop.BusStopName,
                            lastBusStop.ArrivalDateTimeAtThisBusStopForDepartureOrAtTheNextBusStopForArrival, soughtConnection.IsDeparture);
                    }
                    else
                    {
                        singleSoughtConnection = new SoughtConnection(oneBusStop.BusStopName, lastBusStop.BusStopName,
                            lastBusStop.DepartureDateTimeFromPreviousBusStopForDepartureOrFromCurrentBusStopForArrival, soughtConnection.IsDeparture);
                    }
                    SearchResultConnection singleResult = searcherOfDirectConnections.FindDirectConnectionWitMaxWaitingTime(repository, singleSoughtConnection, maxWaitingTime);

                    if (singleResult != null)
                    {
                        TimeOfArrival newArrivalTimeOnEndBusStop = new TimeOfArrival(singleResult.ArrivalDateTime.Hour, singleResult.ArrivalDateTime.Minute);
                        if (oneBusStop.TotalTimeFromStartBus == null)
                        {
                            // only save this informations
                            oneBusStop.ChangeFields(lastBusStop.BusStopName, singleResult.LineNumber,
                                lastBusStop.TotalTimeFromStartBus + singleResult.TimeDistanceBetweenBusStops, singleResult.ArrivalDateTime, singleResult.DepartureDateTime);
                        }
                        else
                        {
                            // check if new time is lower and then save this
                            if ((lastBusStop.TotalTimeFromStartBus + singleResult.TimeDistanceBetweenBusStops) < oneBusStop.TotalTimeFromStartBus) // condition
                            {
                                oneBusStop.ChangeFields(lastBusStop.BusStopName, singleResult.LineNumber,
                                    lastBusStop.TotalTimeFromStartBus + singleResult.TimeDistanceBetweenBusStops, singleResult.ArrivalDateTime, singleResult.DepartureDateTime);
                            }
                        }
                    }
                }
                int indexOfTheNearestBusStop = -1;
                TimeOfArrival actualTotalTimeTravel = new TimeOfArrival(23, 59);
                for (int i = 0; i < busStopsToCheckList.Count; i++)
                {
                    if (busStopsToCheckList[i].TotalTimeFromStartBus == null)
                    {
                        continue;
                    }
                    if (busStopsToCheckList[i].TotalTimeFromStartBus < actualTotalTimeTravel)
                    {
                        indexOfTheNearestBusStop = i;
                        actualTotalTimeTravel = busStopsToCheckList[i].TotalTimeFromStartBus;
                    }
                }
                // probably route doesn't exist
                if (indexOfTheNearestBusStop == -1)
                {
                    break;
                }

                lastBusStop = busStopsToCheckList[indexOfTheNearestBusStop];
                busStopsToCheckList.RemoveAt(indexOfTheNearestBusStop);
                busStopsCheckedList.Add(lastBusStop);
                maxWaitingTime = new TimeOfArrival(0, 20);

                // one of the conditions - found end bus stop and route to this bus stop
                if (lastBusStop.BusStopName.Equals(busStopNameStopCondition))
                {
                    break;
                }

            } while (busStopsToCheckList.Count > 0);

            return busStopsCheckedList;
        }