Refactor the prepare resource operations