public function updateWorkflow($data)
    {
        $action = $this->CurrentAction();

        if (!$this->getTarget() || !$this->getTarget()->canEditWorkflow()) {
            return;
        }

        $allowedFields = $this->getWorkflowFields()->saveableFields();
        unset($allowedFields['TransitionID']);
        foreach ($allowedFields as $field) {
            $fieldName = $field->getName();
            $action->$fieldName = $data[$fieldName];
        }
        $action->write();

        $svc = singleton(WorkflowService::class);
        if (isset($data['TransitionID']) && $data['TransitionID']) {
            $svc->executeTransition($this->getTarget(), $data['TransitionID']);
        } else {
            // otherwise, just try to execute the current workflow to see if it
            // can now proceed based on user input
            $this->execute();
        }
    }