private static bool CheckOrdnungsSystemForNoDataAvailable(OrdnungsSystemType ordnungssystem)
        {
            var retVal = ordnungssystem.Name.Equals(NoDataAvailable);

            retVal = retVal || ordnungssystem.Signatur.Equals(NoDataAvailable);
            retVal = retVal || ordnungssystem.Stufe.Equals(NoDataAvailable);
            if (ordnungssystem.UntergeordnetesOrdnungsSystem != null)
            {
                retVal = retVal || CheckOrdnungsSystemForNoDataAvailable(ordnungssystem.UntergeordnetesOrdnungsSystem);
            }

            return(retVal);
        }
        /// <summary>
        ///     Gets the ordering position data.
        ///     From the ordered position we have to go up until we find "Bestand" or "Teilbestand". This record, is the first
        ///     element.
        ///     From this found position we need to go down, until we find a "Dossier" which ends the search.
        ///     The "Dossier" is not part of the data.
        /// </summary>
        /// <param name="archiveRecord">The archive record.</param>
        /// <returns>
        ///     OrdnungsSystemType or throws an exception if no Bestand, or Teilbestand could be found higher up in the
        ///     hierarchy.
        /// </returns>
        private OrdnungsSystemType GetOrderingPositionData(ArchiveRecord archiveRecord)
        {
            // Do we find a subfonds?
            var startIndex = archiveRecord.Display.ArchiveplanContext.FindLastIndex(i =>
                                                                                    i.Level.Equals(SubFondsLevelIdentifier, StringComparison.InvariantCultureIgnoreCase));

            if (startIndex < 0)
            // Do we find a fonds then?
            {
                startIndex = archiveRecord.Display.ArchiveplanContext.FindLastIndex(i =>
                                                                                    i.Level.Equals(FondsLevelIdentifier, StringComparison.InvariantCultureIgnoreCase));
            }

            if (startIndex < 0)
            {
                throw new InvalidOperationException(
                          "We could not find a fonds or subfonds. Please check your data if the ordered item is located below either a fonds or subfonds.");
            }

            // Now lets find the the first dossier which marks the end
            var endIndex = archiveRecord.Display.ArchiveplanContext.FindIndex(i =>
                                                                              i.Level.Equals(DossierLevelIdentifier, StringComparison.InvariantCultureIgnoreCase));

            if (endIndex < 0)
            {
                throw new InvalidOperationException(
                          "We could not find a dossier. Please check your data if the ordered item is either a dossier or a document.");
            }

            // Now we have the start and the end, now we just have to gather the data.
            var retVal  = new OrdnungsSystemType();
            var current = new OrdnungsSystemType();

            for (var i = startIndex; i < endIndex; i++)
            {
                if (i == startIndex)
                {
                    current = retVal;
                }
                else
                {
                    current.UntergeordnetesOrdnungsSystem = new OrdnungsSystemType();
                    current = current.UntergeordnetesOrdnungsSystem;
                }

                current.Name = !string.IsNullOrEmpty(archiveRecord.Display.ArchiveplanContext[i].Title)
                    ? archiveRecord.Display.ArchiveplanContext[i].Title
                    : NoDataAvailable;
                current.Signatur = !string.IsNullOrEmpty(archiveRecord.Display.ArchiveplanContext[i].RefCode)
                    ? archiveRecord.Display.ArchiveplanContext[i].RefCode
                    : NoDataAvailable;
                current.Stufe = !string.IsNullOrEmpty(archiveRecord.Display.ArchiveplanContext[i].Level)
                    ? archiveRecord.Display.ArchiveplanContext[i].Level
                    : NoDataAvailable;

                // Auf Stufe Serie muss die Serie-Nummer geliefert werden. Dies ist die Nummer nach dem letzten #
                if (current.Stufe == SerieLevelIdentifier)
                {
                    var pattern = @"^.*#(?<number>[^#]+)$";
                    var r       = Regex.Match(current.Signatur, pattern);
                    if (!r.Success)
                    {
                        throw new ArgumentOutOfRangeException(nameof(current.Signatur), current.Signatur,
                                                              "Der Signatur der Stufe Serie fehlt die Serie-Nummer. Die Signatur ist nicht gültig.");
                    }
                }
            }

            return(retVal);
        }