Thanks for your quick reply.
I checked the code you refer to, but I still have trouble because I can't find any documentation.
For the things I want to do I probably should use the MediaService?
But how do I use it? It needs a storage provider and Orchard services object.
Maybe I just don't understand the concepts, but some documentation about this would be nice.