Adding generic prepare resource support
Merge pull request #346 from shenrie/master

Adding generic prepare resource support