public function findEntity($id)
    {
        Logger::get()->debug(sprintf(
            'Finding entity %s...',
            $id
        ));
        $entity = $this->getEntity($id);

        // If the entity is not registered, load it from the persistence layer.
        if (empty($entity)) {
            Logger::get()->debug(sprintf(
                'Entity %s is not cached. Retrieving...',
                $id
            ));
            $className = static::getEntitiesClassName();
            $data = $this->getDataSource()->retrieve($id);

            if (is_array($data)) {
                Logger::get()->debug(sprintf(
                    'Entity %s retrieved.',
                    $id
                ));
                $entity = new $className($data, false);
            } else {
                Logger::get()->debug(sprintf(
                    'Entity %s could not be retrieved.',
                    $id
                ));
                throw new NotFoundException("Entity {$className}:{$id} could not be retrieved.");
            }
        }

        return $entity;
    }