Are you using a stock wrench to take it off? If not, you might want to consider it.
if the staking is too deep to get it off with some wrist-power, you can use a punch to knock the staking back out. There MAY also be locktite on the nut. In that case, a heat gun, or some indirect attention from a torch can help free things up as well.
If all else fails, a good old-fashioned pipe wrench will get it off of there, but the castle nut will be toast, and will require replacement.