protected function getEntityManager() {
        if($this->entities === null) {
            $callable = $this->factory;
            $this->entities = $callable();
        }

        return $this->entities;
    }