Could you
1. Add a comment to explain what problem this function is trying to solve.
2. Add a more specific conditional - it seems like you are doing this action for every single activity type when you probably only care about one.