State machine for return_items.

Fixes #5041
Show flash errors for resource controller html requests

and not for js requests.
When a resource controller failed to create/update there was no indication of what had failed.

Also adds "with_model" gem to allow easier isolated testing of `Spree::Admin::ResourceController`.

Fixes #5011