Redfish: Move checkDbusPathExist function to dbus utility

This function is a utility function which would be needed
by other files.

TestedBy: ran the redfish validator: PASS

Change-Id: I2a0d07f264952f47a724da11f72b15ca5e019d62
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index bb2bd65..2dd3d97 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -89,5 +89,22 @@
     return true;
 }
 
+template <typename Callback>
+inline void checkDbusPathExists(const std::string& path, Callback&& callback)
+{
+    using GetObjectType =
+        std::vector<std::pair<std::string, std::vector<std::string>>>;
+
+    crow::connections::systemBus->async_method_call(
+        [callback{std::move(callback)}](const boost::system::error_code ec,
+                                        const GetObjectType& object_names) {
+            callback(!ec && object_names.size() != 0);
+        },
+        "xyz.openbmc_project.ObjectMapper",
+        "/xyz/openbmc_project/object_mapper",
+        "xyz.openbmc_project.ObjectMapper", "GetObject", path,
+        std::array<std::string, 0>());
+}
+
 } // namespace utility
 } // namespace dbus
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 4ab00e7..2bb1316 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -1018,23 +1018,6 @@
     }
 };
 
-template <typename Callback>
-inline void checkDbusPathExists(const std::string& path, Callback&& callback)
-{
-    using GetObjectType =
-        std::vector<std::pair<std::string, std::vector<std::string>>>;
-
-    crow::connections::systemBus->async_method_call(
-        [callback{std::move(callback)}](const boost::system::error_code ec,
-                                        const GetObjectType& object_names) {
-            callback(!ec && object_names.size() != 0);
-        },
-        "xyz.openbmc_project.ObjectMapper",
-        "/xyz/openbmc_project/object_mapper",
-        "xyz.openbmc_project.ObjectMapper", "GetObject", path,
-        std::array<std::string, 0>());
-}
-
 class ManagerAccount : public Node
 {
   public:
@@ -1253,7 +1236,7 @@
         std::string dbusObjectPath = "/xyz/openbmc_project/user/" + username;
         dbus::utility::escapePathForDbus(dbusObjectPath);
 
-        checkDbusPathExists(
+        dbus::utility::checkDbusPathExists(
             dbusObjectPath,
             [dbusObjectPath(std::move(dbusObjectPath)), username,
              password(std::move(password)), roleId(std::move(roleId)),