Move static form/group/attribute functions out of controllers into models

Getting this out of static method and models feels like a better fit.
Not totally sure about the for_api() fn naming yet.
Add custom error view so that API returns errors as JSON

Possibly a bit of a hack and might need to be replace later when non-api
controllers are added.
Remove custom Form::delete() since cascade delete is handled by DB