/// <summary>
        /// A top-down recursive method to find the nearest neighbors of a given point.
        /// </summary>
        /// <param name="nodeIndex">The index of the node for the current recursion branch.</param>
        /// <param name="target">The point whose neighbors we are trying to find.</param>
        /// <param name="rectCoordinate">The <see cref="HyperRectCoordinate{TDimension}"/> containing the possible nearest neighbors.</param>
        /// <param name="dimension">The current splitting dimension for this recursion branch.</param>
        /// <param name="nearestNeighbors">The <see cref="BoundedPriorityListCoordinate{TElement,TPriority}"/> containing the nearest neighbors already discovered.</param>
        /// <param name="maxSearchRadiusSquared">The squared radius of the current largest distance to search from the <paramref name="target"/></param>
        private void SearchForNearestNeighbors(
            int nodeIndex,
            TDimension target,
            HyperRectCoordinate <TDimension> rectCoordinate,
            int dimension,
            BoundedPriorityListCoordinate <int, double> nearestNeighbors,
            double maxSearchRadiusSquared)
        {
            if (this.InternalTreeOfPoints.Length <= nodeIndex || nodeIndex < 0 || this.InternalTreeOfPoints[nodeIndex] == null)
            {
                return;
            }

            // Work out the current dimension
            var dim = dimension % this.Dimensions;

            var leftRect = rectCoordinate.Clone();

            var rightRect = rectCoordinate.Clone();

            if (dim == 0)
            {
                leftRect.MaxPoint.Latitude  = this.InternalTreeOfPoints[nodeIndex].Latitude;
                rightRect.MinPoint.Latitude = this.InternalTreeOfPoints[nodeIndex].Latitude;
            }
            if (dim == 1)
            {
                leftRect.MaxPoint.Longitude  = this.InternalTreeOfPoints[nodeIndex].Longitude;
                rightRect.MinPoint.Longitude = this.InternalTreeOfPoints[nodeIndex].Longitude;
            }

            // Determine which side the target resides in
            var compare = dim == 0 ? target.Latitude.CompareTo(this.InternalTreeOfPoints[nodeIndex].Latitude)
                                   : target.Longitude.CompareTo(this.InternalTreeOfPoints[nodeIndex].Longitude);

            var nearerRect  = compare <= 0 ? leftRect : rightRect;
            var furtherRect = compare <= 0 ? rightRect : leftRect;

            var nearerNode  = compare <= 0 ? BinaryTreeNavigationCoordinate.LeftChildIndex(nodeIndex) : BinaryTreeNavigationCoordinate.RightChildIndex(nodeIndex);
            var furtherNode = compare <= 0 ? BinaryTreeNavigationCoordinate.RightChildIndex(nodeIndex) : BinaryTreeNavigationCoordinate.LeftChildIndex(nodeIndex);

            // Move down into the nearer branch
            this.SearchForNearestNeighbors(
                nearerNode,
                target,
                nearerRect,
                dimension + 1,
                nearestNeighbors,
                maxSearchRadiusSquared);

            // Walk down into the further branch but only if our capacity hasn't been reached
            // OR if there's a region in the further rectangle that's closer to the target than our
            // current furtherest nearest neighbor
            var closestPointInFurtherRect = furtherRect.GetClosestPoint(target);
            var distanceSquaredToTarget   = this.Metric(closestPointInFurtherRect, target);

            if (distanceSquaredToTarget.CompareTo(maxSearchRadiusSquared) <= 0)
            {
                if (nearestNeighbors.IsFull)
                {
                    if (distanceSquaredToTarget.CompareTo(nearestNeighbors.MaxPriority) < 0)
                    {
                        this.SearchForNearestNeighbors(
                            furtherNode,
                            target,
                            furtherRect,
                            dimension + 1,
                            nearestNeighbors,
                            maxSearchRadiusSquared);
                    }
                }
                else
                {
                    this.SearchForNearestNeighbors(
                        furtherNode,
                        target,
                        furtherRect,
                        dimension + 1,
                        nearestNeighbors,
                        maxSearchRadiusSquared);
                }
            }

            // Try to add the current node to our nearest neighbors list
            distanceSquaredToTarget = this.Metric(this.InternalTreeOfPoints[nodeIndex], target);
            if (distanceSquaredToTarget.CompareTo(maxSearchRadiusSquared) <= 0 && this.InternalTreeOfPoints[nodeIndex].Used == false)
            {
                nearestNeighbors.Add(nodeIndex, distanceSquaredToTarget);
            }
        }