private void RegisterModules(ContainerBuilder builder)
        {
            var solutionsProvider  = new SolutionAssembliesProvider();
            var solutionAssemblies = solutionsProvider.GetSolutionAssemblies();

            foreach (var solutionAssembly in solutionAssemblies)
            {
                var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                var assembly         = loadedAssemblies.FirstOrDefault(asm => asm.Location == solutionAssembly.FullName);
                if (assembly == null)
                {
                    assembly = Assembly.LoadFile(solutionAssembly.FullName);
                }

                var allTypes   = assembly.GetTypes();
                var rightTypes = allTypes
                                 .Where(type => type.IsSubclassOf(typeof(AutofacProfileConfiger)))
                                 .ToArray();

                foreach (var rightType in rightTypes)
                {
                    var profileConfiger = Activator.CreateInstance(rightType) as AutofacProfileConfiger;
                    profileConfiger.ConfigureMappings(builder);
                }
            }

            // Register AutoMapper
            var autoMapperTool = new AutoMapperTool();
            var mapper         = autoMapperTool.GetConfiguredMapper();

            builder.RegisterInstance(mapper).As <IMapper>();
        }
        private void ConfigureAllProfiles(IMapperConfigurationExpression expression)
        {
            var solutionsProvider   = new SolutionAssembliesProvider();
            var escortAssemblyFiles = solutionsProvider.GetSolutionAssemblies();

            foreach (var assemblyFile in escortAssemblyFiles)
            {
                var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                var assembly         = loadedAssemblies.FirstOrDefault(asm => asm.Location == assemblyFile.FullName);
                if (assembly == null)
                {
                    assembly = Assembly.LoadFile(assemblyFile.FullName);
                }

                var allTypes = assembly.GetTypes();
                foreach (var type in allTypes)
                {
                    if (type.BaseType?.FullName != typeof(AutomapperProfileConfiger).FullName)
                    {
                        continue;
                    }

                    var profileConfigerObj = Activator.CreateInstance(type);
                    var profileConfiger    = profileConfigerObj as AutomapperProfileConfiger;
                    profileConfiger.ConfigureMappings(expression);
                }
            }
        }