Hi,
I don't know are you aware that Kentico can generate this kind of example code. Go to Development > API Examples > Content management > Page Basics or Workflow basics. In there try Create Page or Create example object.
I think this will help you on long run.