diff --git a/api/template/service.js b/api/template/service.js
index 2d172f80cf95a58ae3996d033f56a178d027cfd2..2111a862a7a8aeaff03b5965653123e60ca3423e 100644
--- a/api/template/service.js
+++ b/api/template/service.js
@@ -58,11 +58,33 @@ const createTemplate = async (name, desc, widgets, hashId) => {
 
 const getParticularTemplate = async (page,res) => {
   try {
-    const template = await Template.findOne({ name: page}).populate('widgets.widgetId');
+    let pipeline =[];
+    pipeline.push({ '$match': { 'name': page } });
+    pipeline.push({ '$unwind': { path: '$widgets' } });
+    pipeline.push({ $lookup: { localField: "widgets.widgetId", foreignField: "_id", from: "widgets", as: "widget" } });
+        pipeline.push({ $unwind: { "path": "$widget" } });
+
+
+        const group = {
+          $group: {
+              '_id': '$_id', 'name': { '$first': '$name' }, 'desc': { '$first': '$desc' }, 'hashId': { '$first': '$hashId' },
+            
+             'widgets': {
+                    $addToSet: {
+                        'widgetId': '$widget._id', 'title': '$widget.title', 'widget': '$widget.widget',
+                        'enable': '$widget.enable', 'sectionHeadingText': '$widget.sectionHeadingText', 'apiUrl':'$widget.apiUrl',
+                        'buttonData':'$widget.buttonData','list':'$widget.list','position':'$widgets.position','startTime':'$widgets.startTime','endTime':'$widgets.endTime',
+                    }
+                }
+            }
+        };
+        pipeline.push(group);
+        const template = await Template.aggregate(pipeline)
+    // const template = await Template.findOne({ name: page}).populate('widgets');
     if (!template) {
       // return res.status(404).json({ error: 'Template not found' });
       console.error('Template not found');
-      res.status(404).send();
+      // res.status(404).send();
     }
     return template;
   } catch (error) {
diff --git a/swagger.yaml b/swagger.yaml
index 812af00b4f006f197380c03fae8bb1ca83dca530..539b83380074c791102965dcbbfdcfec0b2e5e34 100644
--- a/swagger.yaml
+++ b/swagger.yaml
@@ -39,9 +39,6 @@ paths:
                     type: array
                     items:
                       type: object
-                      properties:
-                        widgetId:
-                          type: string
                         position:
                           type: integer
                         startTime: