public function attach(Entity $entity, $forceReplace = false) {
        $hash = $this->getEntityHash($entity);
        if ($this->isAttached($hash) && !$forceReplace)
            throw new \Exception('Entity "' . $entity->getName() . ' (' . $hash . ')" already attached');

        $this->_entities[$hash] = $entity;
    }