'Copy a workflow (without user information) for a new
StoredWorkflow object.'

def copy(self):

    copied_workflow = Workflow()
    copied_workflow.name = self.name
    copied_workflow.has_cycles = self.has_cycles
    copied_workflow.has_errors = self.has_errors
    step_mapping = {}
    copied_steps = []
    for step in self.steps:
        copied_step = WorkflowStep()
        copied_steps.append(copied_step)
        step_mapping[step.id] = copied_step
    for (old_step, new_step) in zip(self.steps, copied_steps):
        old_step.copy_to(new_step, step_mapping)
    copied_workflow.steps = copied_steps
    return copied_workflow
