When I save my entity it no longer saves the attached fields. I have three address fields that I have attached to my entity through the UI, I used the example to create my custom entity and it works perfectly when I save an entity through the UI.

When i save it programmatically the fields are not attached, when i load the entity, the fields are just not on the entity. I have tried using the myentity_save function I created based on the example. I've tried entity_create, then myentity->save with the created entity. I have also tried the entity_metadata_wrapper and it still doesn't save. I am at a loss, does anyone have any ideas, example code on how to create a fieldable entity that allows you to create an entity and have the fields attach?

TIA