Check if classes/method exists before trying to call them in background jobs

Should fix issues like https://github.com/owncloud/music/issues/248

cc @DeepDiver1975 @karlitschek @PVince81