Editor Duplicate With Properties modification and link to prefab

I am Building a Editor Script that among things i want it to Duplicate Selected GameObjects. From my research i cant seem to find a solution that will maintain any possible connection to a prefab but also maintain any number of changes to its properties Exactly like Edit/Duplicate does.

So my first Question is have i mist something? an Editor or prefab function that maybe is not documented?

Secondly is there a way to simple invoke the systems duplicate function?

I’ve tried :
EditorApplication.ExecuteMenuItem (“Edit/Duplicate”);

But unfortunately i get an error and from what i gather none of Edit Menu its work with ExecuteMenuItem…

Any Clever Ideas?

Thanks In Advance!!

To get the selected gameObjects you can use Selection.gameObjects

To copy a prefab you can instantiate the original prefab.

To save a prefab of your selected gameObject you can use PrefabUtility.CreatePrefab