public function getDocumentTypeBySlug($slug, $getBricks = false)
    {
        $documentTypes = $this->repository->documentTypes;
        foreach ($documentTypes as $documentType) {
            if ($documentType->slug == $slug) {
                if ($getBricks === true) {
                    foreach ($documentType->bricks as $key => $brick) {
                        $brickStructure = $this->getBricks()->getBrickBySlug($brick->brickSlug);
                        $documentType->bricks[$key]->structure = $brickStructure;
                    }
                    foreach ($documentType->dynamicBricks as $key => $brickSlug) {
                        $brickStructure = $this->getBricks()->getBrickBySlug($brickSlug);
                        $documentType->dynamicBricks[$key] = $brickStructure;
                    }
                }

                return $documentType;
            }
        }

        return null;
    }