diff --git a/activation.cpp b/activation.cpp
index cd973b5..40acc89 100755
--- a/activation.cpp
+++ b/activation.cpp
@@ -3,6 +3,7 @@
 #include "config.h"
 #include "item_updater.hpp"
 #include "serialize.hpp"
+#include <phosphor-logging/log.hpp>
 
 namespace openpower
 {
@@ -14,6 +15,8 @@
 namespace fs = std::experimental::filesystem;
 namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server;
 
+using namespace phosphor::logging;
+
 constexpr auto SYSTEMD_SERVICE   = "org.freedesktop.systemd1";
 constexpr auto SYSTEMD_OBJ_PATH  = "/org/freedesktop/systemd1";
 
@@ -89,6 +92,8 @@
 
     ubiVolumesCreated = false;
     Activation::unsubscribeFromSystemdSignals();
+    // Remove version object from image manager
+    Activation::deleteImageManagerObject();
     // Create active association
     parent.createActiveAssociation(path);
 }
@@ -167,6 +172,49 @@
     return softwareServer::Activation::requestedActivation(value);
 }
 
+void Activation::deleteImageManagerObject()
+{
+    // Get the Delete object for <versionID> inside image_manager
+    auto method = this->bus.new_method_call(MAPPER_BUSNAME,
+                                            MAPPER_PATH,
+                                            MAPPER_INTERFACE,
+                                            "GetObject");
+
+    method.append(path);
+    method.append(std::vector<std::string>({
+            "xyz.openbmc_project.Object.Delete"}));
+    auto mapperResponseMsg = bus.call(method);
+    if (mapperResponseMsg.is_method_error())
+    {
+        log<level::ERR>("Error in Get Delete Object",
+                        entry("VERSIONPATH=%s", path));
+        return;
+    }
+    std::map<std::string, std::vector<std::string>> mapperResponse;
+    mapperResponseMsg.read(mapperResponse);
+    if (mapperResponse.begin() == mapperResponse.end())
+    {
+        log<level::ERR>("ERROR in reading the mapper response",
+                        entry("VERSIONPATH=%s", path));
+        return;
+    }
+
+    // Call the Delete object for <versionID> inside image_manager
+    method = this->bus.new_method_call((mapperResponse.begin()->first).c_str(),
+                                       path.c_str(),
+                                       "xyz.openbmc_project.Object.Delete",
+                                       "Delete");
+    mapperResponseMsg = bus.call(method);
+
+    //Check that the bus call didn't result in an error
+    if (mapperResponseMsg.is_method_error())
+    {
+        log<level::ERR>("Error in Deleting image from image manager",
+                        entry("VERSIONPATH=%s", path));
+        return;
+    }
+}
+
 uint8_t RedundancyPriority::priority(uint8_t value)
 {
     parent.parent.freePriority(value, parent.versionId);
@@ -208,46 +256,6 @@
     return;
 }
 
-void Activation::updateDeleteInterface(sdbusplus::message::message& msg)
-{
-    std::string interface, chassisState;
-    std::map<std::string, sdbusplus::message::variant<std::string>> properties;
-
-    msg.read(interface, properties);
-
-    for (const auto& p : properties)
-    {
-        if (p.first == "CurrentPowerState")
-        {
-            chassisState = p.second.get<std::string>();
-        }
-    }
-
-    if ((parent.isVersionFunctional(this->versionId)) &&
-        (chassisState != CHASSIS_STATE_OFF))
-    {
-        if (deleteObject)
-        {
-            deleteObject.reset(nullptr);
-        }
-    }
-    else
-    {
-        if (!deleteObject)
-        {
-            deleteObject = std::make_unique<Delete>(bus, path, *this);
-        }
-    }
-}
-
-void Delete::delete_()
-{
-    // Remove active association
-    parent.parent.removeActiveAssociation(parent.path);
-
-    parent.parent.erase(parent.versionId);
-}
-
 } // namespace updater
 } // namespace software
 } // namespace openpower
