diff --git a/vpd-manager/bios_handler.cpp b/vpd-manager/bios_handler.cpp
index 4271665..d4a5330 100644
--- a/vpd-manager/bios_handler.cpp
+++ b/vpd-manager/bios_handler.cpp
@@ -29,7 +29,7 @@
     // the signal handler, call restoreBIOSAttribs
     static std::shared_ptr<sdbusplus::bus::match_t> nameOwnerMatch =
         std::make_shared<sdbusplus::bus::match_t>(
-            bus,
+            *conn,
             sdbusplus::bus::match::rules::nameOwnerChanged(
                 "xyz.openbmc_project.PLDM"),
             [this](sdbusplus::message_t& msg) {
@@ -86,7 +86,7 @@
 {
     static std::shared_ptr<sdbusplus::bus::match_t> biosMatcher =
         std::make_shared<sdbusplus::bus::match_t>(
-            bus,
+            *conn,
             sdbusplus::bus::match::rules::propertiesChanged(
                 "/xyz/openbmc_project/bios_config/manager",
                 "xyz.openbmc_project.BIOSConfig.Manager"),
diff --git a/vpd-manager/bios_handler.hpp b/vpd-manager/bios_handler.hpp
index 985daa7..dda120c 100644
--- a/vpd-manager/bios_handler.hpp
+++ b/vpd-manager/bios_handler.hpp
@@ -4,24 +4,9 @@
 
 #include <stdint.h>
 
+#include <sdbusplus/asio/connection.hpp>
 #include <string>
 
-namespace sdbusplus
-{
-namespace bus
-{
-class bus;
-} // namespace bus
-} // namespace sdbusplus
-
-namespace sdbusplus
-{
-namespace message
-{
-class message;
-} // namespace message
-} // namespace sdbusplus
-
 namespace openpower
 {
 namespace vpd
@@ -55,8 +40,10 @@
     BiosHandler& operator=(BiosHandler&&) = delete;
     ~BiosHandler() = default;
 
-    BiosHandler(sdbusplus::bus_t& bus, Manager& manager) :
-        bus(bus), manager(manager)
+    BiosHandler(std::shared_ptr<sdbusplus::asio::connection>& conn,
+                Manager& manager) :
+        conn(conn),
+        manager(manager)
     {
         checkAndListenPLDMService();
     }
@@ -254,9 +241,9 @@
     void restoreBIOSAttribs();
 
     /**
-     * @brief Reference to the bus.
+     * @brief Reference to the connection.
      */
-    sdbusplus::bus_t& bus;
+    std::shared_ptr<sdbusplus::asio::connection>& conn;
 
     /**
      * @brief Reference to the manager.
diff --git a/vpd-manager/gpioMonitor.cpp b/vpd-manager/gpioMonitor.cpp
index 69d5e60..1affa62 100644
--- a/vpd-manager/gpioMonitor.cpp
+++ b/vpd-manager/gpioMonitor.cpp
@@ -3,19 +3,12 @@
 #include "common_utility.hpp"
 #include "ibm_vpd_utils.hpp"
 
-#include <systemd/sd-event.h>
-
-#include <chrono>
+#include <boost/asio.hpp>
+#include <boost/bind/bind.hpp>
 #include <gpiod.hpp>
-#include <sdeventplus/clock.hpp>
-#include <sdeventplus/utility/timer.hpp>
 
 using namespace std;
 using namespace openpower::vpd::constants;
-using sdeventplus::ClockId;
-using sdeventplus::Event;
-using Timer = sdeventplus::utility::Timer<ClockId::Monotonic>;
-using namespace std::chrono_literals;
 
 namespace openpower
 {
@@ -44,7 +37,8 @@
     return gpioData;
 }
 
-void GpioMonitor::initGpioInfos(Event& event)
+void GpioMonitor::initGpioInfos(
+    std::shared_ptr<boost::asio::io_context>& ioContext)
 {
     Byte outputValue = 0;
     Byte presenceValue = 0;
@@ -105,7 +99,7 @@
                         make_shared<GpioEventHandler>(
                             presencePinName, presenceValue, outputPinName,
                             outputValue, devNameAddr, driverType, busType,
-                            objectPath, event);
+                            objectPath, ioContext);
 
                     gpioObjects.push_back(gpioObj);
                 }
@@ -161,20 +155,43 @@
     executeCmd(cmnd);
 }
 
-void GpioEventHandler::doEventAndTimerSetup(sdeventplus::Event& event)
+void GpioEventHandler::handleTimerExpiry(
+    const boost::system::error_code& ec,
+    std::shared_ptr<boost::asio::steady_timer>& timer)
+{
+    if (ec == boost::asio::error::operation_aborted)
+    {
+        return;
+    }
+
+    if (ec)
+    {
+        std::cerr << "Timer wait failed for gpio pin" << ec.message();
+        return;
+    }
+
+    if (hasEventOccurred())
+    {
+        toggleGpio();
+    }
+    timer->expires_at(std::chrono::steady_clock::now() +
+                      std::chrono::seconds(5));
+    timer->async_wait(boost::bind(&GpioEventHandler::handleTimerExpiry, this,
+                                  boost::asio::placeholders::error, timer));
+}
+
+void GpioEventHandler::doEventAndTimerSetup(
+    std::shared_ptr<boost::asio::io_context>& ioContext)
 {
     prevPresPinValue = getPresencePinValue();
 
-    static vector<shared_ptr<Timer>> timers;
-    shared_ptr<Timer> timer = make_shared<Timer>(
-        event,
-        [this](Timer&) {
-            if (hasEventOccurred())
-            {
-                toggleGpio();
-            }
-        },
-        std::chrono::seconds{5s});
+    static vector<std::shared_ptr<boost::asio::steady_timer>> timers;
+
+    auto timer = make_shared<boost::asio::steady_timer>(
+        *ioContext, std::chrono::seconds(5));
+
+    timer->async_wait(boost::bind(&GpioEventHandler::handleTimerExpiry, this,
+                                  boost::asio::placeholders::error, timer));
 
     timers.push_back(timer);
 }
diff --git a/vpd-manager/gpioMonitor.hpp b/vpd-manager/gpioMonitor.hpp
index 66c049d..58fbf91 100644
--- a/vpd-manager/gpioMonitor.hpp
+++ b/vpd-manager/gpioMonitor.hpp
@@ -1,8 +1,9 @@
 #pragma once
+#include "types.hpp"
 
-#include "manager.hpp"
-
-#include <sdeventplus/event.hpp>
+#include <boost/asio/steady_timer.hpp>
+#include <nlohmann/json.hpp>
+#include <sdbusplus/asio/connection.hpp>
 
 namespace openpower
 {
@@ -29,13 +30,13 @@
     GpioEventHandler(std::string& presPin, Byte& presValue, std::string& outPin,
                      Byte& outValue, std::string& devAddr, std::string& driver,
                      std::string& bus, std::string& objPath,
-                     sdeventplus::Event& event) :
+                     std::shared_ptr<boost::asio::io_context>& ioCon) :
         presencePin(presPin),
         presenceValue(presValue), outputPin(outPin), outputValue(outValue),
         devNameAddr(devAddr), driverType(driver), busType(bus),
         objectPath(objPath)
     {
-        doEventAndTimerSetup(event);
+        doEventAndTimerSetup(ioCon);
     }
 
   private:
@@ -88,11 +89,20 @@
 
     /** @brief This function runs a timer , which keeps checking for if an event
      *         happened, if event occured then takes action.
-     *  @param[in] timer- Shared pointer of Timer to do event setup for each
-     *                    object.
-     *  @param[in] event- Event which needs to be tagged with the timer.
+     *
+     *  @param[in] ioContext - Pointer to io context object.
      */
-    void doEventAndTimerSetup(sdeventplus::Event& event);
+    void doEventAndTimerSetup(
+        std::shared_ptr<boost::asio::io_context>& ioContext);
+
+    /**
+     * @brief Api to handle timer expiry.
+     *
+     * @param ec - Error code.
+     * @param timer - Pointer to timer object.
+     */
+    void handleTimerExpiry(const boost::system::error_code& ec,
+                           std::shared_ptr<boost::asio::steady_timer>& timer);
 };
 
 /** @class GpioMonitor
@@ -109,9 +119,11 @@
     GpioMonitor(GpioMonitor&&) = delete;
     GpioMonitor& operator=(GpioMonitor&&) = delete;
 
-    GpioMonitor(nlohmann::json& js, sdeventplus::Event& event) : jsonFile(js)
+    GpioMonitor(nlohmann::json& js,
+                std::shared_ptr<boost::asio::io_context>& ioCon) :
+        jsonFile(js)
     {
-        initGpioInfos(event);
+        initGpioInfos(ioCon);
     }
 
   private:
@@ -122,14 +134,10 @@
 
     /** @brief This function will extract the gpio informations from vpd json
      * and store it in GpioEventHandler's private variables
-     *  @param[in] gpioObj - shared object to initialise it's data and it's
-     * Timer setup
-     *  @param[in] requestedGpioPin - Which GPIO's informations need to be
-     * stored
-     *  @param[in] timer - shared object of timer to do the event setup
-     *  @param[in] event - event to be tagged with timer.
+     *
+     * @param[in] ioContext - Pointer to io context object.
      */
-    void initGpioInfos(sdeventplus::Event& event);
+    void initGpioInfos(std::shared_ptr<boost::asio::io_context>& ioContext);
 };
 
 } // namespace manager
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index cf20b0a..23e6290 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -2,10 +2,8 @@
 
 #include "manager.hpp"
 
-#include "bios_handler.hpp"
 #include "common_utility.hpp"
 #include "editor_impl.hpp"
-#include "gpioMonitor.hpp"
 #include "ibm_vpd_utils.hpp"
 #include "ipz_parser.hpp"
 #include "parser_factory.hpp"
@@ -15,7 +13,6 @@
 #include <filesystem>
 #include <phosphor-logging/elog-errors.hpp>
 
-using namespace openpower::vpd::manager;
 using namespace openpower::vpd::constants;
 using namespace openpower::vpd::inventory;
 using namespace openpower::vpd::manager::editor;
@@ -33,16 +30,49 @@
 {
 namespace manager
 {
-Manager::Manager(sdbusplus::bus_t&& bus, const char* busName,
-                 const char* objPath, const char* /*iFace*/) :
-    ServerObject<ManagerIface>(bus, objPath),
-    _bus(std::move(bus)), _manager(_bus, objPath)
+Manager::Manager(std::shared_ptr<boost::asio::io_context>& ioCon,
+                 std::shared_ptr<sdbusplus::asio::dbus_interface>& iFace,
+                 std::shared_ptr<sdbusplus::asio::connection>& conn) :
+    ioContext(ioCon),
+    interface(iFace), conn(conn)
 {
-    _bus.request_name(busName);
+    interface->register_method(
+        "WriteKeyword",
+        [this](const sdbusplus::message::object_path& path,
+               const std::string& recordName, const std::string& keyword,
+               const Binary& value) {
+            this->writeKeyword(path, recordName, keyword, value);
+        });
+
+    interface->register_method(
+        "GetFRUsByUnexpandedLocationCode",
+        [this](const std::string& locationCode,
+               const uint16_t nodeNumber) -> inventory::ListOfPaths {
+            return this->getFRUsByUnexpandedLocationCode(locationCode,
+                                                         nodeNumber);
+        });
+
+    interface->register_method(
+        "GetFRUsByExpandedLocationCode",
+        [this](const std::string& locationCode) -> inventory::ListOfPaths {
+            return this->getFRUsByExpandedLocationCode(locationCode);
+        });
+
+    interface->register_method(
+        "GetExpandedLocationCode",
+        [this](const std::string& locationCode,
+               const uint16_t nodeNumber) -> std::string {
+            return this->getExpandedLocationCode(locationCode, nodeNumber);
+        });
+
+    interface->register_method("PerformVPDRecollection",
+                               [this]() { this->performVPDRecollection(); });
+
     sd_bus_default(&sdBus);
+    initManager();
 }
 
-void Manager::run()
+void Manager::initManager()
 {
     try
     {
@@ -52,14 +82,10 @@
         listenAssetTag();
 
         // Create an instance of the BIOS handler
-        BiosHandler biosHandler{_bus, *this};
+        biosHandler = std::make_shared<BiosHandler>(conn, *this);
 
-        auto event = sdeventplus::Event::get_default();
-        GpioMonitor gpioMon1(jsonFile, event);
-
-        _bus.attach_event(event.get(), SD_EVENT_PRIORITY_IMPORTANT);
-        cout << "VPD manager event loop started\n";
-        event.loop();
+        // instantiate gpioMonitor class
+        gpioMon = std::make_shared<GpioMonitor>(jsonFile, ioContext);
     }
     catch (const std::exception& e)
     {
@@ -169,7 +195,7 @@
 {
     static std::shared_ptr<sdbusplus::bus::match_t> hostState =
         std::make_shared<sdbusplus::bus::match_t>(
-            _bus,
+            *conn,
             sdbusplus::bus::match::rules::propertiesChanged(
                 "/xyz/openbmc_project/state/host0",
                 "xyz.openbmc_project.State.Host"),
@@ -239,7 +265,7 @@
 {
     static std::shared_ptr<sdbusplus::bus::match_t> assetMatcher =
         std::make_shared<sdbusplus::bus::match_t>(
-            _bus,
+            *conn,
             sdbusplus::bus::match::rules::propertiesChanged(
                 "/xyz/openbmc_project/inventory/system",
                 "xyz.openbmc_project.Inventory.Decorator.AssetTag"),
@@ -342,9 +368,9 @@
     }
 }
 
-void Manager::writeKeyword(const sdbusplus::message::object_path path,
-                           const std::string recordName,
-                           const std::string keyword, const Binary value)
+void Manager::writeKeyword(const sdbusplus::message::object_path& path,
+                           const std::string& recordName,
+                           const std::string& keyword, const Binary& value)
 {
     try
     {
@@ -410,7 +436,7 @@
 }
 
 ListOfPaths
-    Manager::getFRUsByUnexpandedLocationCode(const LocationCode locationCode,
+    Manager::getFRUsByUnexpandedLocationCode(const LocationCode& locationCode,
                                              const NodeNumber nodeNumber)
 {
     ReaderImpl read;
@@ -418,13 +444,13 @@
 }
 
 ListOfPaths
-    Manager::getFRUsByExpandedLocationCode(const LocationCode locationCode)
+    Manager::getFRUsByExpandedLocationCode(const LocationCode& locationCode)
 {
     ReaderImpl read;
     return read.getFRUsByExpandedLocationCode(locationCode, fruLocationCode);
 }
 
-LocationCode Manager::getExpandedLocationCode(const LocationCode locationCode,
+LocationCode Manager::getExpandedLocationCode(const LocationCode& locationCode,
                                               const NodeNumber nodeNumber)
 {
     ReaderImpl read;
diff --git a/vpd-manager/manager.hpp b/vpd-manager/manager.hpp
index 4992801..12fc1d4 100644
--- a/vpd-manager/manager.hpp
+++ b/vpd-manager/manager.hpp
@@ -1,19 +1,11 @@
 #pragma once
 
+#include "bios_handler.hpp"
 #include "editor_impl.hpp"
-#include "types.hpp"
+#include "gpioMonitor.hpp"
 
-#include <com/ibm/VPD/Manager/server.hpp>
 #include <map>
-#include <nlohmann/json.hpp>
-
-namespace sdbusplus
-{
-namespace bus
-{
-class bus;
-}
-} // namespace sdbusplus
+#include <sdbusplus/asio/object_server.hpp>
 
 namespace openpower
 {
@@ -22,18 +14,12 @@
 namespace manager
 {
 
-template <typename T>
-using ServerObject = T;
-
-using ManagerIface = sdbusplus::com::ibm::VPD::server::Manager;
-
 /** @class Manager
  *  @brief OpenBMC VPD Manager implementation.
  *
- *  A concrete implementation for the
- *  com.ibm.vpd.Manager
+ *  Implements methods under interface com.ibm.vpd.Manager.
  */
-class Manager : public ServerObject<ManagerIface>
+class Manager
 {
   public:
     /* Define all of the basic class operations:
@@ -54,14 +40,14 @@
         sd_bus_unref(sdBus);
     }
 
-    /** @brief Constructor to put object onto bus at a dbus path.
-     *  @param[in] bus - Bus connection.
-     *  @param[in] busName - Name to be requested on Bus
-     *  @param[in] objPath - Path to attach at.
-     *  @param[in] iFace - interface to implement
+    /** @brief Constructor.
+     *  @param[in] ioCon - IO context.
+     *  @param[in] iFace - interface to implement.
+     *  @param[in] connection - Dbus Connection.
      */
-    Manager(sdbusplus::bus_t&& bus, const char* busName, const char* objPath,
-            const char* iFace);
+    Manager(std::shared_ptr<boost::asio::io_context>& ioCon,
+            std::shared_ptr<sdbusplus::asio::dbus_interface>& iFace,
+            std::shared_ptr<sdbusplus::asio::connection>& conn);
 
     /** @brief Implementation for WriteKeyword
      *  Api to update the keyword value for a given inventory.
@@ -72,9 +58,9 @@
      *  @param[in] keyword - keyword whose value needs to be updated
      *  @param[in] value - value that needs to be updated
      */
-    void writeKeyword(const sdbusplus::message::object_path path,
-                      const std::string recordName, const std::string keyword,
-                      const Binary value);
+    void writeKeyword(const sdbusplus::message::object_path& path,
+                      const std::string& recordName, const std::string& keyword,
+                      const Binary& value);
 
     /** @brief Implementation for GetFRUsByUnexpandedLocationCode
      *  A method to get list of FRU D-BUS object paths for a given unexpanded
@@ -89,7 +75,7 @@
      *  List of all the FRUs D-Bus object paths for the given location code.
      */
     inventory::ListOfPaths
-        getFRUsByUnexpandedLocationCode(const std::string locationCode,
+        getFRUsByUnexpandedLocationCode(const std::string& locationCode,
                                         const uint16_t nodeNumber);
 
     /** @brief Implementation for GetFRUsByExpandedLocationCode
@@ -103,7 +89,7 @@
      *  List of all the FRUs D-Bus object path for the given location code.
      */
     inventory::ListOfPaths
-        getFRUsByExpandedLocationCode(const std::string locationCode);
+        getFRUsByExpandedLocationCode(const std::string& locationCode);
 
     /** @brief Implementation for GetExpandedLocationCode
      *  An API to get expanded location code corresponding to a given
@@ -115,12 +101,9 @@
      *
      *  @return locationCode[std::string] - Location code in expanded format.
      */
-    std::string getExpandedLocationCode(const std::string locationCode,
+    std::string getExpandedLocationCode(const std::string& locationCode,
                                         const uint16_t nodeNumber);
 
-    /** @brief Start processing DBus messages. */
-    void run();
-
     /** @brief Api to perform VPD recollection.
      * This api will trigger parser to perform VPD recollection for FRUs that
      * can be replaced at standby.
@@ -128,6 +111,11 @@
     void performVPDRecollection();
 
   private:
+    /**
+     * @brief An api to process some initial requirements.
+     */
+    void initManager();
+
     /** @brief process the given JSON file
      */
     void processJSON();
@@ -169,11 +157,14 @@
      */
     void checkEssentialFrus();
 
-    /** @brief Persistent sdbusplus DBus bus connection. */
-    sdbusplus::bus_t _bus;
+    // Shared pointer to asio context object.
+    std::shared_ptr<boost::asio::io_context>& ioContext;
 
-    /** @brief sdbusplus org.freedesktop.DBus.ObjectManager reference. */
-    sdbusplus::server::manager_t _manager;
+    // Shared pointer to Dbus interface class.
+    std::shared_ptr<sdbusplus::asio::dbus_interface>& interface;
+
+    // Shared pointer to bus connection.
+    std::shared_ptr<sdbusplus::asio::connection>& conn;
 
     // file to store parsed json
     nlohmann::json jsonFile;
@@ -188,6 +179,12 @@
     // map to hold FRUs which can be replaced at standby
     inventory::ReplaceableFrus replaceableFrus;
 
+    // Shared pointer to gpio monitor object.
+    std::shared_ptr<GpioMonitor> gpioMon;
+
+    // Shared pointer to instance of the BIOS handler.
+    std::shared_ptr<BiosHandler> biosHandler;
+
     // List of FRUs marked as essential in the system.
     inventory::EssentialFrus essentialFrus;
 
diff --git a/vpd-manager/manager_main.cpp b/vpd-manager/manager_main.cpp
index fce02b4..bf8c0d9 100644
--- a/vpd-manager/manager_main.cpp
+++ b/vpd-manager/manager_main.cpp
@@ -2,18 +2,29 @@
 
 #include "manager.hpp"
 
-#include <cstdlib>
-#include <exception>
-#include <iostream>
-#include <sdbusplus/bus.hpp>
+#include <sdbusplus/asio/connection.hpp>
 
 int main(int /*argc*/, char** /*argv*/)
 {
     try
     {
-        openpower::vpd::manager::Manager vpdManager(
-            sdbusplus::bus::new_system(), BUSNAME, OBJPATH, IFACE);
-        vpdManager.run();
+        auto io_con = std::make_shared<boost::asio::io_context>();
+        auto connection =
+            std::make_shared<sdbusplus::asio::connection>(*io_con);
+        connection->request_name(BUSNAME);
+
+        auto server = sdbusplus::asio::object_server(connection);
+
+        std::shared_ptr<sdbusplus::asio::dbus_interface> interface =
+            server.add_interface(OBJPATH, IFACE);
+
+        auto vpdManager = std::make_shared<openpower::vpd::manager::Manager>(
+            io_con, interface, connection);
+        interface->initialize();
+
+        // Start event loop.
+        io_con->run();
+
         exit(EXIT_SUCCESS);
     }
     catch (const std::exception& e)
diff --git a/vpd-manager/meson.build b/vpd-manager/meson.build
index 772b3c4..74bc567 100644
--- a/vpd-manager/meson.build
+++ b/vpd-manager/meson.build
@@ -1,12 +1,10 @@
 systemd = dependency('libsystemd', version: '>= 221')
-phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
 sdeventplus = dependency('sdeventplus')
 
 configuration_inc = include_directories('.', '../', '../vpd-parser/')
 
 vpd_manager_SOURCES =['manager_main.cpp',
                       'manager.cpp',
-                      'server.cpp',
                       'error.cpp',
                       'editor_impl.cpp',
                       'reader_impl.cpp',
@@ -21,10 +19,8 @@
                       '../vpd-parser/parser_factory.cpp'
                      ]
 
-vpd_manager_dependencies =[sdbusplus,
-                           phosphor_logging,
+vpd_manager_dependencies =[phosphor_logging,
                            systemd,
-                           phosphor_dbus_interfaces,
                            libgpiodcxx,
                            sdeventplus,
                           ]
diff --git a/vpd-manager/server.cpp b/vpd-manager/server.cpp
deleted file mode 100644
index 14d2151..0000000
--- a/vpd-manager/server.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-#include <algorithm>
-#include <com/ibm/VPD/Manager/server.hpp>
-#include <com/ibm/VPD/error.hpp>
-#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 <xyz/openbmc_project/Common/error.hpp>
-
-namespace sdbusplus
-{
-namespace com
-{
-namespace ibm
-{
-namespace VPD
-{
-namespace server
-{
-
-Manager::Manager(bus_t& bus, const char* path) :
-    _com_ibm_VPD_Manager_interface(bus, path, interface, _vtable, this),
-    _intf(bus.getInterface())
-{
-}
-
-int Manager::_callback_WriteKeyword(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([=](sdbusplus::message::object_path&& path,
-                              std::string&& record, std::string&& keyword,
-                              std::vector<uint8_t>&& value) {
-                return o->writeKeyword(path, record, keyword, value);
-            }));
-    }
-    catch (
-        const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
-            e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::PathNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::RecordNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::KeywordNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-
-    return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_WriteKeyword = utility::tuple_to_array(
-    message::types::type_id<sdbusplus::message::object_path, std::string,
-                            std::string, std::vector<uint8_t>>());
-static const auto _return_WriteKeyword =
-    utility::tuple_to_array(std::make_tuple('\0'));
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_GetFRUsByUnexpandedLocationCode(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(
-                [=](std::string&& locationCode, uint16_t&& nodeNumber) {
-                    return o->getFRUsByUnexpandedLocationCode(locationCode,
-                                                              nodeNumber);
-                }));
-    }
-    catch (
-        const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
-            e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-
-    return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_GetFRUsByUnexpandedLocationCode =
-    utility::tuple_to_array(message::types::type_id<std::string, uint16_t>());
-static const auto _return_GetFRUsByUnexpandedLocationCode =
-    utility::tuple_to_array(message::types::type_id<
-                            std::vector<sdbusplus::message::object_path>>());
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_GetFRUsByExpandedLocationCode(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([=](std::string&& locationCode) {
-                return o->getFRUsByExpandedLocationCode(locationCode);
-            }));
-    }
-    catch (
-        const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
-            e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-
-    return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_GetFRUsByExpandedLocationCode =
-    utility::tuple_to_array(message::types::type_id<std::string>());
-static const auto _return_GetFRUsByExpandedLocationCode =
-    utility::tuple_to_array(message::types::type_id<
-                            std::vector<sdbusplus::message::object_path>>());
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_GetExpandedLocationCode(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(
-                [=](std::string&& locationCode, uint16_t&& nodeNumber) {
-                    return o->getExpandedLocationCode(locationCode, nodeNumber);
-                }));
-    }
-    catch (
-        const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
-            e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-    catch (const sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
-    {
-        return o->_intf->sd_bus_error_set(error, e.name(), e.description());
-    }
-
-    return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_GetExpandedLocationCode =
-    utility::tuple_to_array(message::types::type_id<std::string, uint16_t>());
-static const auto _return_GetExpandedLocationCode =
-    utility::tuple_to_array(message::types::type_id<std::string>());
-} // 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 (
-        const 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(),
-
-    vtable::method("WriteKeyword", details::Manager::_param_WriteKeyword.data(),
-                   details::Manager::_return_WriteKeyword.data(),
-                   _callback_WriteKeyword),
-
-    vtable::method(
-        "GetFRUsByUnexpandedLocationCode",
-        details::Manager::_param_GetFRUsByUnexpandedLocationCode.data(),
-        details::Manager::_return_GetFRUsByUnexpandedLocationCode.data(),
-        _callback_GetFRUsByUnexpandedLocationCode),
-
-    vtable::method(
-        "GetFRUsByExpandedLocationCode",
-        details::Manager::_param_GetFRUsByExpandedLocationCode.data(),
-        details::Manager::_return_GetFRUsByExpandedLocationCode.data(),
-        _callback_GetFRUsByExpandedLocationCode),
-
-    vtable::method("GetExpandedLocationCode",
-                   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
-} // namespace VPD
-} // namespace ibm
-} // namespace com
-} // namespace sdbusplus
