public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array();
     $arProperties["Permission"] = CBPHelper::UsersStringToArray($arCurrentValues["permission"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     $currentParent =& CBPWorkflowTemplateLoader::FindParentActivityByName($arWorkflowTemplate, $activityName);
     $c = count($currentParent['Children']);
     if ($c == 1) {
         if ($arCurrentValues["setstate"] != '') {
             $currentParent['Children'][] = array('Type' => 'SetStateActivity', 'Name' => md5(uniqid(mt_rand(), true)), 'Properties' => array('TargetStateName' => $arCurrentValues["setstate"]), 'Children' => array());
         }
     } elseif ($currentParent['Children'][$c - 1]["Type"] == 'SetStateActivity') {
         if ($arCurrentValues["setstate"] != '') {
             $currentParent['Children'][$c - 1]["Properties"]['TargetStateName'] = $arCurrentValues["setstate"];
         } else {
             unset($currentParent['Children'][$c - 1]);
         }
     }
     return true;
 }