protected function initEntity($entityClass, $primaryKey)
    {
        $primaryKey = (array) $primaryKey;

        if (!isset($primaryKey[0])) {
            throw new \InvalidArgumentException('Hash key is required');
        }

        $entity = $this->entityFactory($entityClass)->setHashKey($primaryKey[0]);
        if (isset($primaryKey[1])) {
            $entity->setRangeKey($primaryKey[1]);
        }

        return $entity;
    }