public function AddAttribute()
 {
     $attributeName = $this->page->GetLabel();
     $type = $this->page->GetType();
     $scope = $this->page->GetCategory();
     $regex = $this->page->GetValidationExpression();
     $required = $this->page->GetIsRequired();
     $possibleValues = $this->page->GetPossibleValues();
     $sortOrder = $this->page->GetSortOrder();
     $entityId = $this->page->GetEntityId();
     Log::Debug('Adding new attribute named: %s', $attributeName);
     $attribute = CustomAttribute::Create($attributeName, $type, $scope, $regex, $required, $possibleValues, $sortOrder, $entityId);
     $this->attributeRepository->Add($attribute);
 }
 /**
  * @param CustomAttributeRequest $request
  * @param WebServiceUserSession $session
  * @return AttributeControllerResult
  */
 public function Create($request, $session)
 {
     $errors = $this->ValidateRequest($request);
     if (!empty($errors)) {
         return new AttributeControllerResult(null, $errors);
     }
     $attribute = CustomAttribute::Create($request->label, $request->type, $request->categoryId, $request->regex . '', (int) $request->required, $this->GetPossibleValues($request), $request->sortOrder, $request->appliesToId);
     $attributeId = $this->repository->Add($attribute);
     return new AttributeControllerResult($attributeId, null);
 }