public Configuration BuildConfiguration(string basePath = null)
        {
            var dependencyList = basePath == null
                ? DependencyList.WithBasePathOfAssembly(Assembly.GetExecutingAssembly())
                : DependencyList.WithPathPrefix(basePath);

            dependencyList
            .AddAssemblies(_mappingAssemblies);

            if (!string.IsNullOrEmpty(_configFile))
            {
                dependencyList.AddFile(_configFile);
            }
            dependencyList.AddFiles(_additionalDependencies);

            var timestamp = dependencyList.GetLastModificationTime();

            if (timestamp == null)
            {
                throw new InvalidOperationException("No dependencies were specified");
            }

            var configuration = _configurationCache.TryLoad(timestamp.Value);

            if (configuration == null)
            {
                configuration = LoadExternalConfiguration();
                configuration = ApplyCustomSettings(configuration);
                _configurationCache.Save(configuration, timestamp.Value);
            }

            return(configuration);
        }