Close Function parameters in zenon framework

Close Function parameters in zenon framework

Hello!
I am creating a short Engineering studio wizard extension code that reads all frames in IFrameCollection and generates a Close Function for it in case it doesn't exist already. I am having trouble giving the correct argument to SetDynamicProperty that refers to the frame I want to create the Close Function. Any help on this? Any way I can write this differently?

public void Run(IEditorApplication context, IBehavior behavior)
        {
            IProject active = context.Workspace.ActiveProject;

            foreach(IFrame forFrame in active.FrameCollection)
            {
                try
                {
                    string closeFrameFunctionName = "Close" + forFrame.Name;
                    if (active.FunctionCollection[closeFrameFunctionName] == null)
                    {
                        IFunction newFunction = active.FunctionCollection.Create(closeFrameFunctionName, FunctionType.CloseFrame);
                        newFunction.SetDynamicProperty("Parameters", HERE);
                    }
                }

                catch
                {
                    continue;

                }
                
            } 

            #endregion
        }
    }
}