public function createAction($workspaceName, Workspace $baseWorkspace, $ownerAccountIdentifier = null)
{
$existingWorkspace = $this->workspaceRepository->findByIdentifier($workspaceName);
if ($existingWorkspace !== null) {
$this->throwStatus(409, 'Workspace already exists', '');
}
if ($ownerAccountIdentifier !== null) {
$owner = $this->userService->getUser($ownerAccountIdentifier);
if ($owner === null) {
$this->throwStatus(422, 'Requested owner account does not exist', '');
}
} else {
$owner = null;
}
$workspace = new Workspace($workspaceName, $baseWorkspace, $owner);
$this->workspaceRepository->add($workspace);
$this->throwStatus(201, 'Workspace created', '');
}