diff --git a/vpd-manager/server.cpp b/vpd-manager/server.cpp
index 8291ecd..7ca72f6 100644
--- a/vpd-manager/server.cpp
+++ b/vpd-manager/server.cpp
@@ -4,10 +4,10 @@
 #include <map>
 #include <sdbusplus/exception.hpp>
 #include <sdbusplus/sdbus.hpp>
+#include <sdbusplus/sdbuspp_support/server.hpp>
 #include <sdbusplus/server.hpp>
 #include <string>
 #include <tuple>
-#include <variant>
 #include <xyz/openbmc_project/Common/error.hpp>
 
 namespace sdbusplus
@@ -30,55 +30,36 @@
 int Manager::_callback_WriteKeyword(sd_bus_message* msg, void* context,
                                     sd_bus_error* error)
 {
+    auto o = static_cast<Manager*>(context);
+
     try
     {
-        auto m = message::message(msg);
-#if 1
-        {
-            auto tbus = m.get_bus();
-            sdbusplus::server::transaction::Transaction t(tbus, m);
-            sdbusplus::server::transaction::set_id(
-                std::hash<sdbusplus::server::transaction::Transaction>{}(t));
-        }
-#endif
-
-        sdbusplus::message::object_path path{};
-        std::string record{};
-        std::string keyword{};
-        std::vector<uint8_t> value{};
-
-        m.read(path, record, keyword, value);
-
-        auto o = static_cast<Manager*>(context);
-        o->writeKeyword(path, record, keyword, value);
-
-        auto reply = m.new_method_return();
-        // No data to append on reply.
-
-        reply.method_return();
-    }
-    catch (sdbusplus::internal_exception_t& e)
-    {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return sdbusplus::sdbuspp::method_callback(
+            msg, o->_intf, error,
+            std::function([=](sdbusplus::message::object_path&& path,
+                              std::string&& record, std::string&& keyword,
+                              std::vector<uint8_t>&& value) {
+                return o->writeKeyword(path, record, keyword, value);
+            }));
     }
     catch (sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::PathNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::RecordNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::KeywordNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
 
-    return true;
+    return 0;
 }
 
 namespace details
@@ -97,49 +78,32 @@
                                                        void* context,
                                                        sd_bus_error* error)
 {
+    auto o = static_cast<Manager*>(context);
+
     try
     {
-        auto m = message::message(msg);
-#if 1
-        {
-            auto tbus = m.get_bus();
-            sdbusplus::server::transaction::Transaction t(tbus, m);
-            sdbusplus::server::transaction::set_id(
-                std::hash<sdbusplus::server::transaction::Transaction>{}(t));
-        }
-#endif
-
-        std::string locationCode{};
-        uint16_t nodeNumber{};
-
-        m.read(locationCode, nodeNumber);
-
-        auto o = static_cast<Manager*>(context);
-        auto r = o->getFRUsByUnexpandedLocationCode(locationCode, nodeNumber);
-
-        auto reply = m.new_method_return();
-        reply.append(std::move(r));
-
-        reply.method_return();
-    }
-    catch (sdbusplus::internal_exception_t& e)
-    {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return sdbusplus::sdbuspp::method_callback(
+            msg, o->_intf, error,
+            std::function(
+                [=](std::string&& locationCode, uint16_t&& nodeNumber) {
+                    return o->getFRUsByUnexpandedLocationCode(locationCode,
+                                                              nodeNumber);
+                }));
     }
     catch (sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
 
-    return true;
+    return 0;
 }
 
 namespace details
@@ -158,48 +122,30 @@
                                                      void* context,
                                                      sd_bus_error* error)
 {
+    auto o = static_cast<Manager*>(context);
+
     try
     {
-        auto m = message::message(msg);
-#if 1
-        {
-            auto tbus = m.get_bus();
-            sdbusplus::server::transaction::Transaction t(tbus, m);
-            sdbusplus::server::transaction::set_id(
-                std::hash<sdbusplus::server::transaction::Transaction>{}(t));
-        }
-#endif
-
-        std::string locationCode{};
-
-        m.read(locationCode);
-
-        auto o = static_cast<Manager*>(context);
-        auto r = o->getFRUsByExpandedLocationCode(locationCode);
-
-        auto reply = m.new_method_return();
-        reply.append(std::move(r));
-
-        reply.method_return();
-    }
-    catch (sdbusplus::internal_exception_t& e)
-    {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return sdbusplus::sdbuspp::method_callback(
+            msg, o->_intf, error,
+            std::function([=](std::string&& locationCode) {
+                return o->getFRUsByExpandedLocationCode(locationCode);
+            }));
     }
     catch (sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
 
-    return true;
+    return 0;
 }
 
 namespace details
@@ -218,49 +164,31 @@
                                                void* context,
                                                sd_bus_error* error)
 {
+    auto o = static_cast<Manager*>(context);
+
     try
     {
-        auto m = message::message(msg);
-#if 1
-        {
-            auto tbus = m.get_bus();
-            sdbusplus::server::transaction::Transaction t(tbus, m);
-            sdbusplus::server::transaction::set_id(
-                std::hash<sdbusplus::server::transaction::Transaction>{}(t));
-        }
-#endif
-
-        std::string locationCode{};
-        uint16_t nodeNumber{};
-
-        m.read(locationCode, nodeNumber);
-
-        auto o = static_cast<Manager*>(context);
-        auto r = o->getExpandedLocationCode(locationCode, nodeNumber);
-
-        auto reply = m.new_method_return();
-        reply.append(std::move(r));
-
-        reply.method_return();
-    }
-    catch (sdbusplus::internal_exception_t& e)
-    {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return sdbusplus::sdbuspp::method_callback(
+            msg, o->_intf, error,
+            std::function(
+                [=](std::string&& locationCode, uint16_t&& nodeNumber) {
+                    return o->getExpandedLocationCode(locationCode, nodeNumber);
+                }));
     }
     catch (sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
     catch (sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
     {
-        return sd_bus_error_set(error, e.name(), e.description());
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
     }
 
-    return true;
+    return 0;
 }
 
 namespace details
@@ -274,6 +202,37 @@
 } // namespace Manager
 } // namespace details
 
+int Manager::_callback_PerformVPDRecollection(sd_bus_message* msg,
+                                              void* context,
+                                              sd_bus_error* error)
+{
+    auto o = static_cast<Manager*>(context);
+
+    try
+    {
+        return sdbusplus::sdbuspp::method_callback(
+            msg, o->_intf, error,
+            std::function([=]() { return o->performVPDRecollection(); }));
+    }
+    catch (sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument& e)
+    {
+        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
+    }
+
+    return 0;
+}
+
+namespace details
+{
+namespace Manager
+{
+static const auto _param_PerformVPDRecollection =
+    utility::tuple_to_array(std::make_tuple('\0'));
+static const auto _return_PerformVPDRecollection =
+    utility::tuple_to_array(std::make_tuple('\0'));
+} // namespace Manager
+} // namespace details
+
 const vtable::vtable_t Manager::_vtable[] = {
     vtable::start(),
 
@@ -297,6 +256,11 @@
                    details::Manager::_param_GetExpandedLocationCode.data(),
                    details::Manager::_return_GetExpandedLocationCode.data(),
                    _callback_GetExpandedLocationCode),
+
+    vtable::method("PerformVPDRecollection",
+                   details::Manager::_param_PerformVPDRecollection.data(),
+                   details::Manager::_return_PerformVPDRecollection.data(),
+                   _callback_PerformVPDRecollection),
     vtable::end()};
 
 } // namespace server
