This function has two problems: You are modifying a variable inside a `map` call. And secondly, this is not efficient.

Suggestion: Create a `Map[String, String]` for every (alias, accountName) pair.
Then, to apply the alias all you have to do is: `aliasMap.get(accountName).getOrElse(accountName)`