public function findOneByIdentifier($identifier, Workspace $workspace, array $dimensions = null, $removedNodes = false)
    {
        $workspaces = [];
        while ($workspace !== null) {
            /** @var $node NodeData */
            foreach ($this->addedNodes as $node) {
                if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
                    return $node;
                }
            }

            /** @var $node NodeData */
            foreach ($this->removedNodes as $node) {
                if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
                    return null;
                }
            }

            $workspaces[] = $workspace;
            $workspace = $workspace->getBaseWorkspace();
        }

        $queryBuilder = $this->createQueryBuilder($workspaces);
        if ($removedNodes === false) {
            $queryBuilder->andWhere('n.movedTo IS NULL OR n.removed = FALSE');
        } else {
            $queryBuilder->andWhere('n.movedTo IS NULL');
        }
        if ($dimensions !== null) {
            $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions);
        } else {
            $dimensions = [];
        }
        $this->addIdentifierConstraintToQueryBuilder($queryBuilder, $identifier);

        $query = $queryBuilder->getQuery();
        $nodes = $query->getResult();

        $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions);
        if ($removedNodes === false) {
            $foundNodes = $this->withoutRemovedNodes($foundNodes);
        }

        if ($foundNodes !== []) {
            return reset($foundNodes);
        }

        return null;
    }