diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index b6316ef..5d8bb15 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -23,6 +23,8 @@
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
 #include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 #include <utils/json_utils.hpp>
 
 namespace redfish
@@ -1291,7 +1293,9 @@
         asyncResp->res.jsonValue["LDAP"]["Certificates"]["@odata.id"] =
             "/redfish/v1/AccountService/LDAP/Certificates";
     }
-    crow::connections::systemBus->async_method_call(
+    sdbusplus::asio::getAllProperties(
+        *crow::connections::systemBus, "xyz.openbmc_project.User.Manager",
+        "/xyz/openbmc_project/user", "xyz.openbmc_project.User.AccountPolicy",
         [asyncResp](const boost::system::error_code ec,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
         if (ec)
@@ -1299,41 +1303,43 @@
             messages::internalError(asyncResp->res);
             return;
         }
+
         BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
                          << "properties for AccountService";
-        for (const std::pair<std::string, dbus::utility::DbusVariantType>&
-                 property : propertiesList)
+
+        const uint8_t* minPasswordLength = nullptr;
+        const uint32_t* accountUnlockTimeout = nullptr;
+        const uint16_t* maxLoginAttemptBeforeLockout = nullptr;
+
+        const bool success = sdbusplus::unpackPropertiesNoThrow(
+            dbus_utils::UnpackErrorPrinter(), propertiesList,
+            "MinPasswordLength", minPasswordLength, "AccountUnlockTimeout",
+            accountUnlockTimeout, "MaxLoginAttemptBeforeLockout",
+            maxLoginAttemptBeforeLockout);
+
+        if (!success)
         {
-            if (property.first == "MinPasswordLength")
-            {
-                const uint8_t* value = std::get_if<uint8_t>(&property.second);
-                if (value != nullptr)
-                {
-                    asyncResp->res.jsonValue["MinPasswordLength"] = *value;
-                }
-            }
-            if (property.first == "AccountUnlockTimeout")
-            {
-                const uint32_t* value = std::get_if<uint32_t>(&property.second);
-                if (value != nullptr)
-                {
-                    asyncResp->res.jsonValue["AccountLockoutDuration"] = *value;
-                }
-            }
-            if (property.first == "MaxLoginAttemptBeforeLockout")
-            {
-                const uint16_t* value = std::get_if<uint16_t>(&property.second);
-                if (value != nullptr)
-                {
-                    asyncResp->res.jsonValue["AccountLockoutThreshold"] =
-                        *value;
-                }
-            }
+            messages::internalError(asyncResp->res);
+            return;
         }
-        },
-        "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
-        "org.freedesktop.DBus.Properties", "GetAll",
-        "xyz.openbmc_project.User.AccountPolicy");
+
+        if (minPasswordLength != nullptr)
+        {
+            asyncResp->res.jsonValue["MinPasswordLength"] = *minPasswordLength;
+        }
+
+        if (accountUnlockTimeout != nullptr)
+        {
+            asyncResp->res.jsonValue["AccountLockoutDuration"] =
+                *accountUnlockTimeout;
+        }
+
+        if (maxLoginAttemptBeforeLockout != nullptr)
+        {
+            asyncResp->res.jsonValue["AccountLockoutThreshold"] =
+                *maxLoginAttemptBeforeLockout;
+        }
+        });
 
     auto callback = [asyncResp](bool success, const LDAPConfigData& confData,
                                 const std::string& ldapType) {
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 533c15e..faa295a 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -38,6 +38,9 @@
 #include <error_messages.hpp>
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
+#include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 #include <utils/time_utils.hpp>
 
 #include <charconv>
@@ -579,7 +582,8 @@
             {
                 // Dump status is not Complete
                 // return not found until status is changed to Completed
-                messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
+                messages::resourceNotFound(asyncResp->res, dumpType + " dump",
+                                           entryID);
                 return;
             }
 
@@ -871,35 +875,32 @@
                              std::string& filename, std::string& timestamp,
                              std::string& logfile)
 {
-    for (auto property : params)
+    const std::string* filenamePtr = nullptr;
+    const std::string* timestampPtr = nullptr;
+    const std::string* logfilePtr = nullptr;
+
+    const bool success = sdbusplus::unpackPropertiesNoThrow(
+        dbus_utils::UnpackErrorPrinter(), params, "Timestamp", timestampPtr,
+        "Filename", filenamePtr, "Log", logfilePtr);
+
+    if (!success)
     {
-        if (property.first == "Timestamp")
-        {
-            const std::string* value =
-                std::get_if<std::string>(&property.second);
-            if (value != nullptr)
-            {
-                timestamp = *value;
-            }
-        }
-        else if (property.first == "Filename")
-        {
-            const std::string* value =
-                std::get_if<std::string>(&property.second);
-            if (value != nullptr)
-            {
-                filename = *value;
-            }
-        }
-        else if (property.first == "Log")
-        {
-            const std::string* value =
-                std::get_if<std::string>(&property.second);
-            if (value != nullptr)
-            {
-                logfile = *value;
-            }
-        }
+        return;
+    }
+
+    if (filenamePtr != nullptr)
+    {
+        filename = *filenamePtr;
+    }
+
+    if (timestampPtr != nullptr)
+    {
+        timestamp = *timestampPtr;
+    }
+
+    if (logfilePtr != nullptr)
+    {
+        logfile = *logfilePtr;
     }
 }
 
@@ -1500,12 +1501,15 @@
 
         // DBus implementation of EventLog/Entries
         // Make call to Logging Service to find all log entry objects
-        crow::connections::systemBus->async_method_call(
+        sdbusplus::asio::getAllProperties(
+            *crow::connections::systemBus, "xyz.openbmc_project.Logging",
+            "/xyz/openbmc_project/logging/entry/" + entryID, "",
             [asyncResp, entryID](const boost::system::error_code ec,
                                  const dbus::utility::DBusPropertiesMap& resp) {
             if (ec.value() == EBADR)
             {
-                messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
+                messages::resourceNotFound(asyncResp->res, "EventLogEntry",
+                                           entryID);
                 return;
             }
             if (ec)
@@ -1523,45 +1527,18 @@
             const std::string* filePath = nullptr;
             bool resolved = false;
 
-            for (const auto& propertyMap : resp)
+            const bool success = sdbusplus::unpackPropertiesNoThrow(
+                dbus_utils::UnpackErrorPrinter(), resp, "Id", id, "Timestamp",
+                timestamp, "UpdateTimestamp", updateTimestamp, "Severity",
+                severity, "Message", message, "Resolved", resolved, "Path",
+                filePath);
+
+            if (!success)
             {
-                if (propertyMap.first == "Id")
-                {
-                    id = std::get_if<uint32_t>(&propertyMap.second);
-                }
-                else if (propertyMap.first == "Timestamp")
-                {
-                    timestamp = std::get_if<uint64_t>(&propertyMap.second);
-                }
-                else if (propertyMap.first == "UpdateTimestamp")
-                {
-                    updateTimestamp =
-                        std::get_if<uint64_t>(&propertyMap.second);
-                }
-                else if (propertyMap.first == "Severity")
-                {
-                    severity = std::get_if<std::string>(&propertyMap.second);
-                }
-                else if (propertyMap.first == "Message")
-                {
-                    message = std::get_if<std::string>(&propertyMap.second);
-                }
-                else if (propertyMap.first == "Resolved")
-                {
-                    const bool* resolveptr =
-                        std::get_if<bool>(&propertyMap.second);
-                    if (resolveptr == nullptr)
-                    {
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    resolved = *resolveptr;
-                }
-                else if (propertyMap.first == "Path")
-                {
-                    filePath = std::get_if<std::string>(&propertyMap.second);
-                }
+                messages::internalError(asyncResp->res);
+                return;
             }
+
             if (id == nullptr || message == nullptr || severity == nullptr ||
                 timestamp == nullptr || updateTimestamp == nullptr)
             {
@@ -1590,10 +1567,7 @@
                     "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
                     std::to_string(*id) + "/attachment";
             }
-            },
-            "xyz.openbmc_project.Logging",
-            "/xyz/openbmc_project/logging/entry/" + entryID,
-            "org.freedesktop.DBus.Properties", "GetAll", "");
+            });
         });
 
     BMCWEB_ROUTE(
@@ -2834,10 +2808,10 @@
             logEntryJson.update(logEntry);
         }
     };
-    crow::connections::systemBus->async_method_call(
-        std::move(getStoredLogCallback), crashdumpObject,
-        crashdumpPath + std::string("/") + logID,
-        "org.freedesktop.DBus.Properties", "GetAll", crashdumpInterface);
+    sdbusplus::asio::getAllProperties(
+        *crow::connections::systemBus, crashdumpObject,
+        crashdumpPath + std::string("/") + logID, crashdumpInterface,
+        std::move(getStoredLogCallback));
 }
 
 inline void requestRoutesCrashdumpEntryCollection(App& app)
@@ -2989,10 +2963,10 @@
             asyncResp->res.addHeader(
                 boost::beast::http::field::content_disposition, "attachment");
         };
-        crow::connections::systemBus->async_method_call(
-            std::move(getStoredLogCallback), crashdumpObject,
-            crashdumpPath + std::string("/") + logID,
-            "org.freedesktop.DBus.Properties", "GetAll", crashdumpInterface);
+        sdbusplus::asio::getAllProperties(
+            *crow::connections::systemBus, crashdumpObject,
+            crashdumpPath + std::string("/") + logID, crashdumpInterface,
+            std::move(getStoredLogCallback));
         });
 }
 
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index b4d6433..47c5c91 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -21,6 +21,9 @@
 #include <dbus_utility.hpp>
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
+#include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 
 namespace redfish
 {
@@ -174,6 +177,49 @@
                 return;
             }
 
+            const std::string* manufacturer = nullptr;
+            const std::string* deviceType = nullptr;
+            const std::string* generationInUse = nullptr;
+
+            const bool success = sdbusplus::unpackPropertiesNoThrow(
+                dbus_utils::UnpackErrorPrinter(), pcieDevProperties,
+                "Manufacturer", manufacturer, "DeviceType", deviceType,
+                "GenerationInUse", generationInUse);
+
+            if (!success)
+            {
+                messages::internalError(asyncResp->res);
+                return;
+            }
+
+            if (generationInUse != nullptr)
+            {
+                std::optional<std::string> redfishGenerationInUse =
+                    redfishPcieGenerationFromDbus(*generationInUse);
+                if (!redfishGenerationInUse)
+                {
+                    messages::internalError(asyncResp->res);
+                    return;
+                }
+                if (redfishGenerationInUse->empty())
+                {
+                    // unknown, no need to handle
+                    return;
+                }
+                asyncResp->res.jsonValue["PCIeInterface"]["PCIeType"] =
+                    *redfishGenerationInUse;
+            }
+
+            if (manufacturer != nullptr)
+            {
+                asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
+            }
+
+            if (deviceType != nullptr)
+            {
+                asyncResp->res.jsonValue["DeviceType"] = *deviceType;
+            }
+
             asyncResp->res.jsonValue["@odata.type"] =
                 "#PCIeDevice.v1_4_0.PCIeDevice";
             asyncResp->res.jsonValue["@odata.id"] =
@@ -184,57 +230,12 @@
             asyncResp->res.jsonValue["PCIeFunctions"]["@odata.id"] =
                 "/redfish/v1/Systems/system/PCIeDevices/" + device +
                 "/PCIeFunctions";
-            for (const auto& property : pcieDevProperties)
-            {
-                const std::string* propertyString =
-                    std::get_if<std::string>(&property.second);
-                if (property.first == "Manufacturer")
-                {
-                    if (propertyString == nullptr)
-                    {
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    asyncResp->res.jsonValue["Manufacturer"] = *propertyString;
-                }
-                if (property.first == "DeviceType")
-                {
-                    if (propertyString == nullptr)
-                    {
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    asyncResp->res.jsonValue["DeviceType"] = *propertyString;
-                }
-                if (property.first == "GenerationInUse")
-                {
-                    if (propertyString == nullptr)
-                    {
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    std::optional<std::string> generationInUse =
-                        redfishPcieGenerationFromDbus(*propertyString);
-                    if (!generationInUse)
-                    {
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    if (generationInUse->empty())
-                    {
-                        // unknown, no need to handle
-                        return;
-                    }
-                    asyncResp->res.jsonValue["PCIeInterface"]["PCIeType"] =
-                        *generationInUse;
-                }
-            }
         };
         std::string escapedPath = std::string(pciePath) + "/" + device;
         dbus::utility::escapePathForDbus(escapedPath);
-        crow::connections::systemBus->async_method_call(
-            std::move(getPCIeDeviceCallback), pcieService, escapedPath,
-            "org.freedesktop.DBus.Properties", "GetAll", pcieDeviceInterface);
+        sdbusplus::asio::getAllProperties(
+            *crow::connections::systemBus, pcieService, escapedPath,
+            pcieDeviceInterface, std::move(getPCIeDeviceCallback));
         });
 }
 
@@ -320,9 +321,9 @@
         };
         std::string escapedPath = std::string(pciePath) + "/" + device;
         dbus::utility::escapePathForDbus(escapedPath);
-        crow::connections::systemBus->async_method_call(
-            std::move(getPCIeDeviceCallback), pcieService, escapedPath,
-            "org.freedesktop.DBus.Properties", "GetAll", pcieDeviceInterface);
+        sdbusplus::asio::getAllProperties(
+            *crow::connections::systemBus, pcieService, escapedPath,
+            pcieDeviceInterface, std::move(getPCIeDeviceCallback));
         });
 }
 
@@ -435,9 +436,9 @@
         };
         std::string escapedPath = std::string(pciePath) + "/" + device;
         dbus::utility::escapePathForDbus(escapedPath);
-        crow::connections::systemBus->async_method_call(
-            std::move(getPCIeDeviceCallback), pcieService, escapedPath,
-            "org.freedesktop.DBus.Properties", "GetAll", pcieDeviceInterface);
+        sdbusplus::asio::getAllProperties(
+            *crow::connections::systemBus, pcieService, escapedPath,
+            pcieDeviceInterface, std::move(getPCIeDeviceCallback));
         });
 }
 
diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp
index cff1e27..778768f 100644
--- a/redfish-core/lib/pcie_slots.hpp
+++ b/redfish-core/lib/pcie_slots.hpp
@@ -6,6 +6,9 @@
 #include <app.hpp>
 #include <pcie.hpp>
 #include <registries/privilege_registry.hpp>
+#include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 #include <utils/json_utils.hpp>
 
 namespace redfish
@@ -85,66 +88,56 @@
 
     nlohmann::json::object_t slot;
 
-    for (const auto& property : propertiesList)
-    {
-        const std::string& propertyName = property.first;
+    const std::string* generation = nullptr;
+    const size_t* lanes = nullptr;
+    const std::string* slotType = nullptr;
+    const bool* hotPluggable = nullptr;
 
-        if (propertyName == "Generation")
-        {
-            const std::string* value =
-                std::get_if<std::string>(&property.second);
-            if (value == nullptr)
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
-            std::optional<std::string> pcieType =
-                redfishPcieGenerationFromDbus(*value);
-            if (!pcieType)
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
-            slot["PCIeType"] = !pcieType;
-        }
-        else if (propertyName == "Lanes")
-        {
-            const size_t* value = std::get_if<size_t>(&property.second);
-            if (value == nullptr)
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
-            slot["Lanes"] = *value;
-        }
-        else if (propertyName == "SlotType")
-        {
-            const std::string* value =
-                std::get_if<std::string>(&property.second);
-            if (value == nullptr)
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
-            std::string slotType = dbusSlotTypeToRf(*value);
-            if (!slotType.empty())
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
-            slot["SlotType"] = slotType;
-        }
-        else if (propertyName == "HotPluggable")
-        {
-            const bool* value = std::get_if<bool>(&property.second);
-            if (value == nullptr)
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
-            slot["HotPluggable"] = *value;
-        }
+    const bool success = sdbusplus::unpackPropertiesNoThrow(
+        dbus_utils::UnpackErrorPrinter(), propertiesList, "Generation",
+        generation, "Lanes", lanes, "SlotType", slotType, "HotPluggable",
+        hotPluggable);
+
+    if (!success)
+    {
+        messages::internalError(asyncResp->res);
+        return;
     }
+
+    if (generation != nullptr)
+    {
+        std::optional<std::string> pcieType =
+            redfishPcieGenerationFromDbus(*generation);
+        if (!pcieType)
+        {
+            messages::internalError(asyncResp->res);
+            return;
+        }
+        slot["PCIeType"] = !pcieType;
+    }
+
+    if (lanes != nullptr)
+    {
+
+        slot["Lanes"] = *lanes;
+    }
+
+    if (slotType != nullptr)
+    {
+        std::string redfishSlotType = dbusSlotTypeToRf(*slotType);
+        if (!slotType.empty())
+        {
+            messages::internalError(asyncResp->res);
+            return;
+        }
+        slot["SlotType"] = redfishSlotType;
+    }
+
+    if (hotPluggable != nullptr)
+    {
+        slot["HotPluggable"] = *hotPluggable;
+    }
+
     slots.emplace_back(std::move(slot));
 }
 
@@ -191,13 +184,13 @@
         return;
     }
 
-    crow::connections::systemBus->async_method_call(
+    sdbusplus::asio::getAllProperties(
+        *crow::connections::systemBus, connectionName, pcieSlotPath,
+        "xyz.openbmc_project.Inventory.Item.PCIeSlot",
         [asyncResp](const boost::system::error_code ec,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
         onPcieSlotGetAllDone(asyncResp, ec, propertiesList);
-        },
-        connectionName, pcieSlotPath, "org.freedesktop.DBus.Properties",
-        "GetAll", "xyz.openbmc_project.Inventory.Item.PCIeSlot");
+        });
 }
 
 inline void
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index cecaeab..47f0c5d 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -23,6 +23,7 @@
 #include <dbus_utility.hpp>
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
+#include <sdbusplus/asio/property.hpp>
 
 namespace redfish
 {
@@ -288,11 +289,11 @@
                 }
             };
 
-            crow::connections::systemBus->async_method_call(
-                std::move(valueHandler), "xyz.openbmc_project.Settings",
+            sdbusplus::asio::getAllProperties(
+                *crow::connections::systemBus, "xyz.openbmc_project.Settings",
                 "/xyz/openbmc_project/control/host0/power_cap",
-                "org.freedesktop.DBus.Properties", "GetAll",
-                "xyz.openbmc_project.Control.Power.Cap");
+                "xyz.openbmc_project.Control.Power.Cap",
+                std::move(valueHandler));
         };
 
         crow::connections::systemBus->async_method_call(
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 30b679d..cf1b441 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -23,6 +23,8 @@
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
 #include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 
 namespace redfish
 {
@@ -165,7 +167,9 @@
                 }
                 });
 
-            crow::connections::systemBus->async_method_call(
+            sdbusplus::asio::getAllProperties(
+                *crow::connections::systemBus, connectionName, path,
+                "xyz.openbmc_project.Inventory.Decorator.Asset",
                 [asyncResp, index](
                     const boost::system::error_code ec2,
                     const std::vector<
@@ -176,35 +180,46 @@
                     // this interface isn't necessary
                     return;
                 }
-                for (const std::pair<std::string,
-                                     dbus::utility::DbusVariantType>& property :
-                     propertiesList)
+
+                const std::string* partNumber = nullptr;
+                const std::string* serialNumber = nullptr;
+                const std::string* manufacturer = nullptr;
+                const std::string* model = nullptr;
+
+                const bool success = sdbusplus::unpackPropertiesNoThrow(
+                    dbus_utils::UnpackErrorPrinter(), propertiesList,
+                    "PartNumber", partNumber, "SerialNumber", serialNumber,
+                    "Manufacturer", manufacturer, "Model", model);
+
+                if (!success)
                 {
-                    // Store DBus properties that are also
-                    // Redfish properties with same name and a
-                    // string value
-                    const std::string& propertyName = property.first;
-                    nlohmann::json& controller =
-                        asyncResp->res.jsonValue["StorageControllers"][index];
-                    if ((propertyName == "PartNumber") ||
-                        (propertyName == "SerialNumber") ||
-                        (propertyName == "Manufacturer") ||
-                        (propertyName == "Model"))
-                    {
-                        const std::string* value =
-                            std::get_if<std::string>(&property.second);
-                        if (value == nullptr)
-                        {
-                            // illegal property
-                            messages::internalError(asyncResp->res);
-                            return;
-                        }
-                        controller[propertyName] = *value;
-                    }
+                    messages::internalError(asyncResp->res);
+                    return;
                 }
-                },
-                connectionName, path, "org.freedesktop.DBus.Properties",
-                "GetAll", "xyz.openbmc_project.Inventory.Decorator.Asset");
+
+                nlohmann::json& controller =
+                    asyncResp->res.jsonValue["StorageControllers"][index];
+
+                if (partNumber != nullptr)
+                {
+                    controller["PartNumber"] = *partNumber;
+                }
+
+                if (serialNumber != nullptr)
+                {
+                    controller["SerialNumber"] = *serialNumber;
+                }
+
+                if (manufacturer != nullptr)
+                {
+                    controller["Manufacturer"] = *manufacturer;
+                }
+
+                if (model != nullptr)
+                {
+                    controller["Model"] = *model;
+                }
+                });
         }
 
         // this is done after we know the json array will no longer
@@ -262,7 +277,9 @@
                           const std::string& connectionName,
                           const std::string& path)
 {
-    crow::connections::systemBus->async_method_call(
+    sdbusplus::asio::getAllProperties(
+        *crow::connections::systemBus, connectionName, path,
+        "xyz.openbmc_project.Inventory.Decorator.Asset",
         [asyncResp](const boost::system::error_code ec,
                     const std::vector<
                         std::pair<std::string, dbus::utility::DbusVariantType>>&
@@ -272,31 +289,43 @@
             // this interface isn't necessary
             return;
         }
-        for (const std::pair<std::string, dbus::utility::DbusVariantType>&
-                 property : propertiesList)
+
+        const std::string* partNumber = nullptr;
+        const std::string* serialNumber = nullptr;
+        const std::string* manufacturer = nullptr;
+        const std::string* model = nullptr;
+
+        const bool success = sdbusplus::unpackPropertiesNoThrow(
+            dbus_utils::UnpackErrorPrinter(), propertiesList, "PartNumber",
+            partNumber, "SerialNumber", serialNumber, "Manufacturer",
+            manufacturer, "Model", model);
+
+        if (!success)
         {
-            // Store DBus properties that are also
-            // Redfish properties with same name and a
-            // string value
-            const std::string& propertyName = property.first;
-            if ((propertyName == "PartNumber") ||
-                (propertyName == "SerialNumber") ||
-                (propertyName == "Manufacturer") || (propertyName == "Model"))
-            {
-                const std::string* value =
-                    std::get_if<std::string>(&property.second);
-                if (value == nullptr)
-                {
-                    // illegal property
-                    messages::internalError(asyncResp->res);
-                    return;
-                }
-                asyncResp->res.jsonValue[propertyName] = *value;
-            }
+            messages::internalError(asyncResp->res);
+            return;
         }
-        },
-        connectionName, path, "org.freedesktop.DBus.Properties", "GetAll",
-        "xyz.openbmc_project.Inventory.Decorator.Asset");
+
+        if (partNumber != nullptr)
+        {
+            asyncResp->res.jsonValue["PartNumber"] = *partNumber;
+        }
+
+        if (serialNumber != nullptr)
+        {
+            asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
+        }
+
+        if (manufacturer != nullptr)
+        {
+            asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
+        }
+
+        if (model != nullptr)
+        {
+            asyncResp->res.jsonValue["Model"] = *model;
+        }
+        });
 }
 
 inline void getDrivePresent(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index fd4f53f..9acf568 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -22,6 +22,8 @@
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
 #include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 #include <utils/sw_utils.hpp>
 
 namespace redfish
@@ -818,7 +820,9 @@
                        const std::string& service, const std::string& path,
                        const std::string& swId)
 {
-    crow::connections::systemBus->async_method_call(
+    sdbusplus::asio::getAllProperties(
+        *crow::connections::systemBus, service, path,
+        "xyz.openbmc_project.Software.Version",
         [asyncResp,
          swId](const boost::system::error_code errorCode,
                const dbus::utility::DBusPropertiesMap& propertiesList) {
@@ -827,18 +831,18 @@
             messages::internalError(asyncResp->res);
             return;
         }
+
         const std::string* swInvPurpose = nullptr;
         const std::string* version = nullptr;
-        for (const auto& property : propertiesList)
+
+        const bool success = sdbusplus::unpackPropertiesNoThrow(
+            dbus_utils::UnpackErrorPrinter(), propertiesList, "Purpose",
+            swInvPurpose, "Version", version);
+
+        if (!success)
         {
-            if (property.first == "Purpose")
-            {
-                swInvPurpose = std::get_if<std::string>(&property.second);
-            }
-            else if (property.first == "Version")
-            {
-                version = std::get_if<std::string>(&property.second);
-            }
+            messages::internalError(asyncResp->res);
+            return;
         }
 
         if (swInvPurpose == nullptr)
@@ -880,9 +884,7 @@
         std::string formatDesc = swInvPurpose->substr(endDesc);
         asyncResp->res.jsonValue["Description"] = formatDesc + " image";
         getRelatedItems(asyncResp, *swInvPurpose);
-        },
-        service, path, "org.freedesktop.DBus.Properties", "GetAll",
-        "xyz.openbmc_project.Software.Version");
+        });
 }
 
 inline void requestRoutesSoftwareInventory(App& app)
