private AutoPersistenceModel GetAutoPersistenceModel()
        {
            var autoPersistenceModel = AutoMap.Assemblies(new AutomappingConfiguration(), _sessionContext.LocateDomainAssemblies().ToArray());

            // Add Pillar NHibernate conventions
            autoPersistenceModel = autoPersistenceModel.Conventions.AddFromAssemblyOf <AutomappingConfiguration>();

            // To allow two persistent classes with the same unqualified name


            // Add conventions and overrides from infrastructure assebmlies
            var infrastructureAssebmlies = _sessionContext.LocateInfrastructureAssemblies();

            foreach (var infrastructureAssebmly in infrastructureAssebmlies)
            {
                autoPersistenceModel = autoPersistenceModel
                                       .Conventions.AddAssembly(infrastructureAssebmly)
                                       .UseOverridesFromAssembly(infrastructureAssebmly);
            }
            foreach (var type in _sessionContext.IgnoreBaseTypes())
            {
                autoPersistenceModel.IgnoreBase(type);
            }
            autoPersistenceModel.AddFilter <AppFilterSoftDelete>();
            autoPersistenceModel.AddFilter <AppFilterOrganization>();
            return(autoPersistenceModel);
        }