diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index b74dc4d..32e9725 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -153,96 +153,6 @@
         });
 }
 
-/**
- * @brief Retrieves identify system led group properties over dbus
- *
- * @param[in] asyncResp     Shared pointer for generating response message.
- *
- * @return None.
- */
-inline void getSystemLocationIndicatorActive(
-    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
-{
-    BMCWEB_LOG_DEBUG("Get LocationIndicatorActive");
-    dbus::utility::getProperty<bool>(
-        "xyz.openbmc_project.LED.GroupManager",
-        "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
-        "xyz.openbmc_project.Led.Group", "Asserted",
-        [asyncResp](const boost::system::error_code& ec, const bool blinking) {
-            // Some systems may not have enclosure_identify_blink object so
-            // proceed to get enclosure_identify state.
-            if (ec == boost::system::errc::invalid_argument)
-            {
-                BMCWEB_LOG_DEBUG(
-                    "Get identity blinking LED failed, mismatch in property type");
-                messages::internalError(asyncResp->res);
-                return;
-            }
-
-            // Blinking ON, no need to check enclosure_identify assert.
-            if (!ec && blinking)
-            {
-                asyncResp->res.jsonValue["LocationIndicatorActive"] = true;
-                return;
-            }
-
-            dbus::utility::getProperty<bool>(
-                "xyz.openbmc_project.LED.GroupManager",
-                "/xyz/openbmc_project/led/groups/enclosure_identify",
-                "xyz.openbmc_project.Led.Group", "Asserted",
-                [asyncResp](const boost::system::error_code& ec2,
-                            const bool ledOn) {
-                    if (ec2 == boost::system::errc::invalid_argument)
-                    {
-                        BMCWEB_LOG_DEBUG(
-                            "Get enclosure identity led failed, mismatch in property type");
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-
-                    if (ec2)
-                    {
-                        return;
-                    }
-
-                    asyncResp->res.jsonValue["LocationIndicatorActive"] = ledOn;
-                });
-        });
-}
-
-/**
- * @brief Sets identify system led group properties
- *
- * @param[in] asyncResp     Shared pointer for generating response message.
- * @param[in] ledState  LED state passed from request
- *
- * @return None.
- */
-inline void setSystemLocationIndicatorActive(
-    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool ledState)
-{
-    BMCWEB_LOG_DEBUG("Set LocationIndicatorActive");
-
-    sdbusplus::asio::setProperty(
-        *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
-        "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
-        "xyz.openbmc_project.Led.Group", "Asserted", ledState,
-        [asyncResp, ledState](const boost::system::error_code& ec) {
-            if (ec)
-            {
-                // Some systems may not have enclosure_identify_blink object so
-                // lets set enclosure_identify state also if
-                // enclosure_identify_blink failed
-                setDbusProperty(
-                    asyncResp, "LocationIndicatorActive",
-                    "xyz.openbmc_project.LED.GroupManager",
-                    sdbusplus::message::object_path(
-                        "/xyz/openbmc_project/led/groups/enclosure_identify"),
-                    "xyz.openbmc_project.Led.Group", "Asserted", ledState);
-            }
-        });
-}
-
 inline void handleLedGroupSubtree(
     const std::string& objPath, const boost::system::error_code& ec,
     const dbus::utility::MapperGetSubTreeResponse& subtree,
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 2be5dde..e006b9a 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -3114,7 +3114,16 @@
             aRsp->res.jsonValue["Links"]["Chassis"] = std::move(chassisArray);
         });
 
-    getSystemLocationIndicatorActive(asyncResp);
+    systems_utils::getValidSystemsPath(
+        asyncResp, systemName,
+        [asyncResp,
+         systemName](const std::optional<std::string>& validSystemsPath) {
+            if (validSystemsPath)
+            {
+                getLocationIndicatorActive(asyncResp, *validSystemsPath);
+            }
+        });
+
     // TODO (Gunnar): Remove IndicatorLED after enough time has passed
     getIndicatorLedState(asyncResp);
     getComputerSystem(asyncResp);
@@ -3248,7 +3257,20 @@
 
     if (locationIndicatorActive)
     {
-        setSystemLocationIndicatorActive(asyncResp, *locationIndicatorActive);
+        systems_utils::getValidSystemsPath(
+            asyncResp, systemName,
+            [asyncResp, systemName,
+             locationIndicatorActive{*locationIndicatorActive}](
+                const std::optional<std::string>& validSystemsPath) {
+                if (!validSystemsPath)
+                {
+                    messages::resourceNotFound(asyncResp->res, "Systems",
+                                               systemName);
+                    return;
+                }
+                setLocationIndicatorActive(asyncResp, *validSystemsPath,
+                                           locationIndicatorActive);
+            });
     }
 
     // TODO (Gunnar): Remove IndicatorLED after enough time has
