public void Execute(UpdaterData data)
        {
            //Toggle check
            if (m_updateActive == false) { return; }

            Document doc = data.GetDocument();

            //Check schema by getting the titleblock family symbol
            SchemaAndStoreData schema = new SchemaAndStoreData();
            Titleblock titleblock = new Titleblock();
            titleblock.getTitleblockCurrentView(doc);
            titleblock.TitleblockFamilySymbolList(doc);
            titleblock.getTitleblockName();
            string test = titleblock.getSheetName();
            FamilySymbol familySymbol = titleblock.getFamilySymbol(titleblock.getSheetName());

            if (schema.StorageExists(familySymbol) == true)
            {
                var modifiedIds = data.GetModifiedElementIds();

                foreach (var id in modifiedIds)
                {
                    // gets modifed element in project
                    Element modifiedId = doc.GetElement(id);

                    if (modifiedId.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Viewports)
                    {
                        Viewport modifiedView = (Viewport)modifiedId;

                        string selectedview = null;
                        string selectedNumber = null;
                        string selectedSheetNumber = null;

                        ViewLocation viewLocation = new ViewLocation();

                        selectedview = modifiedView.get_Parameter(BuiltInParameter.VIEW_NAME).AsString();
                        selectedNumber = modifiedView.get_Parameter(BuiltInParameter.VIEWPORT_DETAIL_NUMBER).AsString();
                        selectedSheetNumber = modifiedView.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NUMBER).AsString();

                        try
                        {
                            if (selectedview != null && selectedNumber != null)
                            {
                                viewLocation.getViewCoord(doc, selectedview);
                                viewLocation.setCoordinate(doc, selectedview, selectedNumber, selectedSheetNumber);

                                //    TODO add auto trigger for title. Not avaiable in API
                            }
                        }
                        catch { }
                    }
                }

            }
        }
        public void schemadata(Document doc, string titleblock)
        {
            TitleblockSettings settingsWindow = new TitleblockSettings(doc);
            string selectedTitleblock = settingsWindow.TitleblockComboBox.Text;
            Titleblock tb = new Titleblock();
            tb.TitleblockFamilySymbolList(doc);
            FamilySymbol familySymbol = tb.getFamilySymbol(titleblock);

            bool SchemeExist = schemaAndStoreData.StorageExists(familySymbol);
            if (SchemeExist == true)
            {
                schemaAndStoreData.RetrieveData(familySymbol);

                titleblockName = schemaAndStoreData.Get_titleblockName();

                cellSizeDistance_X = schemaAndStoreData.Get_cellSizeDistance_X();
                lowerGap_X = schemaAndStoreData.Get_lowerGap_X();
                additionalEdge_X = schemaAndStoreData.Get_additionalEdge_X();
                fineTune_X = schemaAndStoreData.Get_fineTune_X();

                cellSizeDistance_Y = schemaAndStoreData.Get_cellSizeDistance_Y();
                lowerGap_Y = schemaAndStoreData.Get_lowerGap_Y();
                additionalEdge_Y = schemaAndStoreData.Get_additionalEdge_Y();
                fineTune_Y = schemaAndStoreData.Get_fineTune_Y();

                cellGrid_Length = schemaAndStoreData.Get_cellGrid_Length();
                cellGrid_Height = schemaAndStoreData.Get_cellGrid_Height();
            }
        }
        //Set the coordinate of the picked view.
        public void setCoordinate(Document doc, string item, string detailNumber, string selectedSheetNumber)
        {
            Viewport viewport = null;

            var filtercollector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Viewports)
                .WhereElementIsNotElementType().ToElements();

            foreach (Element e in filtercollector)
            {
                Viewport vp = e as Viewport;

                //gets the Viewport name which is the drafting sheet name
                string stringViewport = vp.get_Parameter(BuiltInParameter.VIEW_NAME).AsString();

                if (stringViewport == item)
                {
                    string viewType = ViewsType(doc, stringViewport);

                    //Get current titleblock in view
                    Titleblock titleblock = new Titleblock();
                    titleblock.getTitleblockCurrentView(doc);
                    titleblock.TitleblockFamilySymbolList(doc);
                    string titleblockName = titleblock.getSheetName();
                    FamilySymbol familySymbol = titleblock.getFamilySymbol(titleblockName);

                    SchemaAndStoreData schemaAndStoreData = new SchemaAndStoreData();

                    bool SchemeExist = schemaAndStoreData.StorageExists(familySymbol);
                    bool AppearsInSheetList = titleblock.sheetAppearsInList(doc, selectedSheetNumber);

                    if (familySymbol != null)
                    {
                        double cellSizeDistance_X = 0.0;
                        double lowerGap_X = 0.0;
                        double additionalEdge_X = 0.0;
                        double fineTune_X = 0.0;

                        double cellSizeDistance_Y = 0.0;
                        double lowerGap_Y = 0.0;
                        double additionalEdge_Y = 0.0;
                        double fineTune_Y = 0.0;

                        //string numberOfcells = "";
                        int numberOfcells_Length = 0;
                        int numberOfcells_Height = 0;

                        if (SchemeExist == true && AppearsInSheetList == true)
                        {
                            schemaAndStoreData.RetrieveData(familySymbol);

                            titleblockName = schemaAndStoreData.Get_titleblockName();
                            try
                            {
                                cellSizeDistance_X = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_cellSizeDistance_X()));
                                lowerGap_X = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_lowerGap_X()));
                                additionalEdge_X = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_additionalEdge_X()));
                                fineTune_X = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_fineTune_X()));

                                cellSizeDistance_Y = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_cellSizeDistance_Y()));
                                lowerGap_Y = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_lowerGap_Y()));
                                additionalEdge_Y = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_additionalEdge_Y()));
                                fineTune_Y = ConvertToFeet(Convert.ToDouble(schemaAndStoreData.Get_fineTune_Y()));

                                //numberOfcells = schemaAndStoreData.Get_cellGrid();
                                numberOfcells_Length = Convert.ToInt16(schemaAndStoreData.Get_cellGrid_Length());
                                numberOfcells_Height = Convert.ToInt16(schemaAndStoreData.Get_cellGrid_Height());

                            }
                            catch { }

                        }

                        //Cell number and location
                        int Int_detailNumber = 0;

                        Int_detailNumber = CellNumber.CellNum(detailNumber, doc);
                        Point location = CellNumber.SheetGrid(numberOfcells_Length, numberOfcells_Height, Int_detailNumber);

                        double Xlocation = location.getX();
                        double Ylocation = location.getY();

                        if (viewType == "FloorPlan" || viewType == "EngineeringPlan" || viewType == "Section")
                        {
                            x1 = (((Ylocation * cellSizeDistance_X) + lowerGap_X) - additionalEdge_X) + fineTune_X; // x direction
                            y1 = (((Xlocation * cellSizeDistance_Y) + lowerGap_Y) + (additionalEdge_Y * 2)) - fineTune_Y; // y direction

                            /*
                             * get the center point from the lower left corner
                             * XLower Right = Xcenter - [XLower Left - XCenter] Needed to flip below
                             * YLower Right = Ycenter - [YUpper Left - YCenter] Needed to flip below
                            */
                            titleblkCell_X = (leftLower.X - center.X) + x1;
                            titleblkCell_Y = (topRight.Y - center.Y) + y1;

                            XYZ CoordinateNumber = new XYZ(titleblkCell_X, titleblkCell_Y, z1);
                            viewport = vp;
                            viewport.SetBoxCenter(CoordinateNumber);
                            }

                        if (viewType == "DraftingView")
                        {
                            x1 = ((Ylocation * cellSizeDistance_X) + lowerGap_X) + fineTune_X; // x direction
                            y1 = ((Xlocation * cellSizeDistance_Y) + lowerGap_Y) - fineTune_Y; // y direction

                            /*
                             * get the center point from the lower left corner
                             * XLower Right = Xcenter - [XLower Left - XCenter] Needed to flip below
                             * YLower Right = Ycenter - [YUpper Left - YCenter] Needed to flip below
                            */
                            titleblkCell_X = (leftLower.X - center.X) + x1;
                            titleblkCell_Y = (topRight.Y - center.Y) + y1;

                            XYZ CoordinateNumber = new XYZ(titleblkCell_X, titleblkCell_Y, z1);
                            viewport = vp;
                            viewport.SetBoxCenter(CoordinateNumber);
                        }
                    }
                }
            }
        }