/**
  * Validate the data if they are invalid (INSERT and UPDATE)
  *
  * @param string $messageEventRelationUid Unique id of Message-Event-Relation
  * @param string $projectUid              Unique id of Project
  * @param array  $arrayData               Data
  *
  * return void Throw exception if data has an invalid value
  */
 public function throwExceptionIfDataIsInvalid($messageEventRelationUid, $projectUid, array $arrayData)
 {
     try {
         //Set variables
         $arrayMessageEventRelationData = $messageEventRelationUid == "" ? array() : $this->getMessageEventRelation($messageEventRelationUid, true);
         $flagInsert = $messageEventRelationUid == "" ? true : false;
         $arrayFinalData = array_merge($arrayMessageEventRelationData, $arrayData);
         //Verify data - Field definition
         $process = new \ProcessMaker\BusinessModel\Process();
         $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
         //Verify data
         if (isset($arrayData["EVN_UID_THROW"]) || isset($arrayData["EVN_UID_CATCH"])) {
             $this->throwExceptionIfEventRelationIsRegistered($projectUid, $arrayFinalData["EVN_UID_THROW"], $arrayFinalData["EVN_UID_CATCH"], $messageEventRelationUid);
         }
         if (isset($arrayData["EVN_UID_THROW"]) || isset($arrayData["EVN_UID_CATCH"])) {
             //Flow
             $bpmnFlow = \BpmnFlow::findOneBy(array(\BpmnFlowPeer::FLO_TYPE => "MESSAGE", \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $arrayFinalData["EVN_UID_THROW"], \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent", \BpmnFlowPeer::FLO_ELEMENT_DEST => $arrayFinalData["EVN_UID_CATCH"], \BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => "bpmnEvent"));
             if (is_null($bpmnFlow)) {
                 throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_RELATION_DOES_NOT_EXIST_MESSAGE_FLOW", array($this->arrayFieldNameForException["eventUidThrow"], $arrayFinalData["EVN_UID_THROW"], $this->arrayFieldNameForException["eventUidCatch"], $arrayFinalData["EVN_UID_CATCH"])));
             }
             //Check and validate Message Flow
             $bpmn = new \ProcessMaker\Project\Bpmn();
             $bpmn->throwExceptionFlowIfIsAnInvalidMessageFlow(array("FLO_TYPE" => "MESSAGE", "FLO_ELEMENT_ORIGIN" => $arrayFinalData["EVN_UID_THROW"], "FLO_ELEMENT_ORIGIN_TYPE" => "bpmnEvent", "FLO_ELEMENT_DEST" => $arrayFinalData["EVN_UID_CATCH"], "FLO_ELEMENT_DEST_TYPE" => "bpmnEvent"));
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }