id instanceof UserEntity ? $cmd->id : $this->repo->ofUniqueKey($cmd->id); $user->generateApiKey(); return $user; } }