private void InitializeLookups()
        {
            using (var soilProfile1DReader = new SoilProfile1DReader(Path))
            {
                soilProfile1DReader.Initialize();

                while (soilProfile1DReader.HasNext)
                {
                    try
                    {
                        SoilProfile1D soilProfile1D = soilProfile1DReader.ReadSoilProfile();

                        long soilProfileId = soilProfile1D.Id;
                        if (!soilProfile1Ds.ContainsKey(soilProfileId))
                        {
                            soilProfile1Ds.Add(soilProfileId, soilProfile1D);
                        }
                    }
                    catch (SoilProfileReadException e)
                    {
                        throw new StochasticSoilModelException(e.Message, e);
                    }
                }
            }

            using (var soilProfile2DReader = new SoilProfile2DReader(Path))
            {
                soilProfile2DReader.Initialize();

                while (soilProfile2DReader.HasNext)
                {
                    try
                    {
                        SoilProfile2D soilProfile2D = soilProfile2DReader.ReadSoilProfile();

                        long soilProfileId = soilProfile2D.Id;
                        if (!soilProfile2Ds.ContainsKey(soilProfileId))
                        {
                            soilProfile2Ds.Add(soilProfileId, soilProfile2D);
                        }
                    }
                    catch (SoilProfileReadException e)
                    {
                        throw new StochasticSoilModelException(e.Message, e);
                    }
                }
            }
        }
        /// <summary>
        /// Reads the information for the next soil profile from the database and creates a
        /// <see cref="SoilProfile1D"/> instance of the information.
        /// </summary>
        /// <returns>The next <see cref="SoilProfile1D"/> from the database, or <c>null</c>
        /// if no more soil profile can be read.</returns>
        /// <exception cref="SoilProfileReadException">Thrown when reading properties of the profile failed.</exception>
        /// <exception cref="CriticalFileReadException">Thrown when the database returned incorrect
        /// values for required properties.</exception>
        public SoilProfile1D ReadSoilProfile()
        {
            try
            {
                SoilProfile1D soilProfile = TryReadSoilProfile();
                return(soilProfile);
            }
            catch (SystemException exception) when(exception is FormatException ||
                                                   exception is OverflowException ||
                                                   exception is InvalidCastException)
            {
                string message = new FileReaderErrorMessageBuilder(Path).Build(Resources.SoilProfileReader_Error_reading_soil_profile_from_database);

                throw new CriticalFileReadException(message, exception);
            }
        }