Raw stats from player

I´m currently trying to get the raw stats such as strength agility attackpower spellpower etc from the player and put these into a database.

But I want to get these value´s without buffs applied.

Currently I think the most valid approach for this to to remove player buffs at logout, get the stats and then (optionally) put them back.

Another approach would be to get the stats(with buffs), then loop through every aura and if this is a “buff” remove the gained stats from the end result.

I would appreciate help/thoughts on the topic.

-Midna

Edit:

http://www.trinitycore.info/Character_stats_tc2