Set a gameobject as 'Navigation Static' and its layer programmatically

Is there a way to

  1. Set a gameobject as Navigation
    Static

  2. Select a navigation layer

all programmatically in the editor ?

Check GameObjectUtility and StaticEditorFlags.