Follow up on #641

Wanted to send a PR for my follow-up changes, rather than pushing them to master directly:

- Check for `profilePath` instead of `id.split(':').pop()`
- Fix `url` bug in `transformPersistentActivityEntity` for users and groups
- Adjusted the tests to verify the above
- Temporarily reverted the `_.extend` functions, because I'd like to confirm that there are no performance implications + the extending of the `compact` function might have the unwanted side effect of still pointing to the original object (needs some investigation).

For the last point, I can either create a separate ticket for bringing this back with the required investigation and a performance test or you can decide to push the extend changes in after all, in which case I would like to see a performance test + the investigation in the next couple of days. I don't expect there to be a significant performance decrease, but it's better to be safe than sorry.