http://projectpokemon.org/wiki/Pokemon_Black/White_NDS_Structure
I assume you are referring to that? Yeah, I've got some model files to work from and it works fine for those but it appears to be arranged in a different block shuffling manner to what I'm able to figure out.
Again, could just be me...
I'm getting completely nonsensical PID values when I try to read them from the byte[] array. Where pid: is in the unencryped 50 odd bytes prior to the encrypted .pkm and ppid: is what I'm trying to make sense of.
I've also tried reversing the byte[] order, just to see if it's just me being silly about reading it right, and that was equally unhelpful.