Add support for resources by name

This is quite a large PR. Please use as a basis for discussion.
Have to check if this has a corresponding name in the api.