How to copy all variables from a procedure

Unofficial Content
//Obtaining the target procedure
Artech.Genexus.Common.Objects.Procedure oProc = Artech.Genexus.Common.Objects.Procedure.Get(UIServices.KB.CurrentModel, "MyOriginalProc"); ;

//Copying all variables from the precedure
Artech.Genexus.Common.Objects.Procedure oNewProc = new Artech.Genexus.Common.Objects.Procedure(UIServices.KB.CurrentModel);
oNewProc.Name = "ProcedureCopy";
foreach (Variable oVariable in oProc.Variables.Variables)
{
	Variable oVariableNew = new Variable(oNewProc.Variables);
	oVariableNew.Name = oNewProc.Name + oVariable.Name;
	//CopyPropertiesFrom method copies all properties from the variable except its name
	oVariableNew.CopyPropertiesFrom(oVariable);
	oNewProc.Variables.Add(oVariableNew);
}
oNewProc.Save();