DRY up the resource copying