Refactor the prepare resource operations
Merge pull request #957 from shenrie/master

Refactor the prepare resource operations