protected function getFinalSchemas(KernelInterface $kernel, BundleInterface $bundle = null)
    {
        if (null !== $bundle) {
            return $this->getSchemasFromBundle($bundle);
        }

        $finalSchemas = array();
        foreach ($kernel->getBundles() as $bundle) {
            $finalSchemas = array_merge($finalSchemas, $this->getSchemasFromBundle($bundle));
        }

        return $finalSchemas;
    }