Refactor load_resource in photos_controller