public function createUser($groupPath, Request $request)
{
$userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
$userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
$userCreateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
try {
$createdUser = $this->userService->createUser($userCreateStruct, array($userGroup));
} catch (ApiExceptions\InvalidArgumentException $e) {
throw new ForbiddenException($e->getMessage());
}
$createdContentInfo = $createdUser->getVersionInfo()->getContentInfo();
$createdLocation = $this->locationService->loadLocation($createdContentInfo->mainLocationId);
$contentType = $this->contentTypeService->loadContentType($createdContentInfo->contentTypeId);
return new Values\CreatedUser(array('user' => new Values\RestUser($createdUser, $contentType, $createdContentInfo, $createdLocation, $this->contentService->loadRelations($createdUser->getVersionInfo()))));
}