Remove code duplication from voodoospark-adaptor