Replace new Resource() with std::make_shared<Resource>().