public function Create($request, $session) { $errors = $this->validator->ValidateCreateRequest($request); if (!empty($errors)) { return new ResourceControllerResult(null, $errors); } $newResource = BookableResource::CreateNew($request->name, $request->scheduleId, $request->autoAssignPermissions, $request->sortOrder); $resourceId = $this->repository->Add($newResource); $resource = $this->BuildResource($request, $resourceId); $this->repository->Update($resource); return new ResourceControllerResult($resourceId, null); }