Fix add and edit methods, and create an add+edit method

Hi Pico. I hope you don't mind my changes here.

I really studied your code, and it was great work, but found some problems. I was able to clean it up I believe. And was also able to move all common code between these two methods into one new add_edit method as Nathan suggested.

The idea is:
1.Grab form data in each add and edit method (because they each do it a little differently)
2.Pass the data array to the add_edit function
3.Process it in there into the entity, and validate it. Generate preview if needed, otherwise, create common template data.
4.Return true/false if there were errors back to our original add and edit functions.
5. If no no errors, submit changes.
6. Output any remaining add or edit function specific template code