protected function buildObjectsStructure($dbname = null)
    {
        $dbname = str_replace(array(CarteBlanche::getPath('root_path'), CarteBlanche::getPath('config_dir')), '', $dbname);
        $tables_def = CarteBlanche::getConfig($dbname.'_database.db_structure');
        $tables_def_file = Locator::locateConfig($tables_def);

        if ($tables_def_file && @file_exists($tables_def_file) && @is_file($tables_def_file)) {
            $table = array();
            include $tables_def_file;
            if (!empty($tables)) {
                $tables_stacks=array();
                foreach ($tables as $_tbl) {
                    $_t_n = $_tbl['table'];
                    $tables_stacks[$_t_n] = new \CarteBlanche\Library\AutoObject\AutoObject( $_t_n, $_tbl, $_t_n, $dbname );
                    $this->registry->setEntry(
                        $_tbl['table'],
                        $tables_stacks[$_t_n],
                        $dbname
                    );
                }
                return $tables_stacks;
            } else
                throw new \RuntimeException(
                    sprintf('Tables definition can\'t be found in file "%s"!', $tables_def)
                );
        } else
            throw new \RuntimeException(
                sprintf('Tables definition file "%s" can\'t be found!', $tables_def)
            );
    }