public void ExeAdd(object obj)
            {
                MyGrid.Clear();
                var data = obj as DataGrid;

                var DeviceMat   = getAllDeviceMat();
                var TypesToShow = DeviceMat.Where(X => X.TypeName == SelType.TypeName).ToList();

                List <DeviceModel> DevicesAndDetail = new List <DeviceModel>();

                foreach (var item in TypesToShow)
                {
                    DeviceModel SingleDevice = new DeviceModel();
                    SingleDevice.Device = item;
                    var maskDesc   = GetMaskDescription(item.Id);
                    var tabsAndAtt = MapMaskDescriptionModel(maskDesc);

                    DeviceBasedOnType.Add(item); //check what is item
                    SingleDevice.TabsAndAttribute = tabsAndAtt;
                    DevicesAndDetail.Add(SingleDevice);
                }
                var listToShow = MergeMultiTabsAttributes(DevicesAndDetail);

                foreach (var item in listToShow)
                {
                    item.TabAttributesWithId = searchAttribute(item.TabAttributes).FirstOrDefault();

                    foreach (var IdItems in item.TabAttributesWithId.ToList())
                    {
                        var Destinationpath = GetPath(IdItems);
                    }
                }
                #region close
                List <GetAttrDesc> AttrDetails = new List <GetAttrDesc>();
                //var GetTabAttributesWithId = from x in listToShow from f in x.TabAttributesWithId from y in f.ToList() select y;
                //GetTabAttributesWithId.ToList().ForEach(y =>
                //{
                //    AttrDetails = GetAttrDescs(y);

                //});

                //listToShow.ForEach(x =>
                //{
                //    SolidColorBrush mySolidColorBrush = new SolidColorBrush { Color = Colors.SteelBlue };
                //    SolidColorBrush mySolidColorBrush2 = new SolidColorBrush { Color = Colors.White };
                //    MyGrid.Add(new ModelData() { FontSize = "13", ColorSet = mySolidColorBrush, Attributes = x.TabName.Name, FontSet = mySolidColorBrush2 });
                //    {
                //        AttrDetails.ForEach(y => {
                //           SolidColorBrush mySolidColorBrush3 = new SolidColorBrush { Color = Colors.Black };
                //            MyGrid.Add(new ModelData() { FontSet = mySolidColorBrush3, Assistant = y.Asst, ID = y.AttrID, Data_Service = y.DataSer,  Attributes = y.AttrName,  Type = y.Type, Def_Unit = y.DefU, Unit_group = y.Ugroup, AttrFoldPath = y.AttrFoldPath });
                //        });
                //    }
                //});

                //listToShow.ForEach(x =>
                //{
                //    x.TabAttributesWithId.ForEach(f => f.ToList().ForEach(y =>
                //    {
                //        // foreach (var attr in y.Attributes)
                //        // {
                //        test = GetAttrDescs(y);

                //        //    }

                //    }));
                //});
                #endregion
                int val = 0;
                listToShow.ForEach(x =>
                {
                    SolidColorBrush mySolidColorBrush = new SolidColorBrush {
                        Color = Colors.SteelBlue
                    };
                    SolidColorBrush mySolidColorBrush2 = new SolidColorBrush {
                        Color = Colors.White
                    };

                    MyGrid.Add(new ModelData()
                    {
                        FontSize = "13", ColorSet = mySolidColorBrush, Attributes = x.TabName.Name, FontSet = mySolidColorBrush2
                    });
                    {
                        x.TabAttributesWithId.ToList().ForEach(y =>
                        {
                            var Destinationpath = GetPath(y);
                            SolidColorBrush mySolidColorBrush3 = new SolidColorBrush {
                                Color = Colors.Black
                            };
                            var getType = GetAttrType(y.Attributes.GetAttributeValue(AttributeId.AttributType));
                            var Dic     = new Dictionary <string, object>();
                            var id      = int.Parse(y.Attributes.GetAttributeValue(AttributeId.Aid));
                            //var DevicesToshow = DevicesAndDetail.Select(p => p.Device.Attributes.Where(l => l.Id == (AttributeId)id)).FirstOrDefault();
                            //var DevicesToshow = DevicesAndDetail.Where(p => p.Device.Attributes.Where(l => l.Id == (AttributeId)id))).S();
                            var DevicesToshow = from i in DevicesAndDetail from u in i.Device.Attributes where u.Id == (AttributeId)id select i;
                            foreach (var device in DevicesToshow)
                            {
                                Dic.Add(device.Device.Name, "X");
                            }

                            MyGrid.Add(new ModelData()
                            {
                                Type = getType.ToString(), Source = y, Data_Service = y.Attributes.GetAttributeValue((AttributeId)177, null), FontSet = mySolidColorBrush3, ID = id, Attributes = y.Name, TabBelongsToo = x.TabName.Name, Assistant = y.Name, AttrFoldPath = Destinationpath, Unit_group = y.Attributes.GetAttributeValue((AttributeId)698, null), Custom = Dic
                            });
                            val++;
                        });
                    }
                });
            }