public function getEntity($key)
    {
        if (\count($this->identifier) > 1) {
            // $key is a collection index
            $entities = $this->getEntities();

            return $entities[$key] ?? null;
        } elseif ($this->entities) {
            return isset($this->entities[$key]) ? $this->entities[$key] : null;
        }

        return $this->modelManager->find($this->class, $key);
    }