private void CopyAttributes(Rock.Model.Workflow newWorkflow, Rock.Model.WorkflowActivity currentActivity, RockContext rockContext) { if (currentActivity.Attributes == null) { currentActivity.LoadAttributes( rockContext ); } if (currentActivity.Workflow.Attributes == null) { currentActivity.Workflow.LoadAttributes( rockContext ); } // Pass attributes from current Workflow to new Workflow. foreach (string key in currentActivity.Workflow.AttributeValues.Keys) { newWorkflow.SetAttributeValue( key, currentActivity.Workflow.GetAttributeValue( key ) ); } // Pass attributes from current Activity to new Workflow. foreach (string key in currentActivity.AttributeValues.Keys) { newWorkflow.SetAttributeValue( key, currentActivity.GetAttributeValue(key) ); } }