public WorkflowAdmin AddWorkflowAdmin(WorkflowAdmin workflow)
        {
            vault.MetricGatherer.MethodCalled();

            // TODO: verify
            if (workflow is TestWorkflowAdmin)
            {
                vault.Workflows.Add((TestWorkflowAdmin)workflow);
            }
            else
            {
                xWorkflowAdmin    wkAdmin = new xWorkflowAdmin(workflow);
                TestWorkflowAdmin twka    = new TestWorkflowAdmin(wkAdmin);
                vault.Workflows.Add(twka);
            }

            ValueListItem valueListItemWorkflow = new ValueListItem {
                ID = workflow.Workflow.ID, Name = workflow.Workflow.Name
            };

            vault.ValueListItemOperations.AddValueListItem(( int )MFBuiltInValueList.MFBuiltInValueListWorkflows,
                                                           valueListItemWorkflow);
            for (int i = 1; i <= workflow.States.Count; ++i)
            {
                StateAdmin    stateAdmin         = workflow.States[i];
                ValueListItem valueListItemState = new ValueListItem {
                    ID = stateAdmin.ID, Name = stateAdmin.Name, OwnerID = workflow.Workflow.ID
                };
                vault.ValueListItemOperations.AddValueListItem(( int )MFBuiltInValueList.MFBuiltInValueListStates,
                                                               valueListItemState);
            }
            return(workflow);
        }
        public States GetWorkflowStates(int workflow, TypedValue currentState = null)
        {
            vault.MetricGatherer.MethodCalled();

            TestWorkflowAdmin workflowAdmin = vault.Workflows.FirstOrDefault(wf => wf.Workflow.ID == workflow);

            if (workflowAdmin == null)
            {
                throw new Exception("Workflow not found. ID: " + workflow);
            }

            TestStates states = new TestStates(workflowAdmin.states);

            return(states);
        }