public List<string> prohibitedDimension(string metric)
        {
            XmlLoader loader = new XmlLoader();
            loader.Loader();
            metItem = metric;
            metCategories = loader.MetCategories;
            dimCategories = loader.DimCategories;

            // M1. Visitor
            foreach (XElement subMetElement in metCategories[0].Elements("Metric"))
            {
                if (metric.Equals("time on site") || metric.Equals("visits"))
                {
                    prohibited.Add("exit page path");
                    prohibited.Add("landing page path");
                    prohibited.Add("second page path");
                }

                if (metric.Equals("visitors"))
                {
                    prohibited.Add("hour");

                    foreach (XElement subElement in dimCategories.Elements("Dimension"))
                    {
                        prohibited.Add(subElement.FirstAttribute.Value);
                    }

                    // Remove time dimensions, except "hour", from the invalidation list
                    foreach (string timeDimension in TimeDimensions())
                    {
                        prohibited.Remove(timeDimension);
                    }

                    foreach (XElement subMetricElement in metCategories.Elements("Metric"))
                    {
                        prohibited.Add(subMetricElement.FirstAttribute.Value);
                    }

                    // Remove M1. Visitor from the invalidation list.
                    foreach (XElement subVisitorElement in metCategories[0].Elements("Metric"))
                    {
                        prohibited.Remove(subVisitorElement.FirstAttribute.Value);
                    }

                }
            }
            /***************************************** M2. Campaign ******************************************/
            foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
            {
                if (subMetElement.FirstAttribute.Value.Equals(metric))
                {
                    // Prohibited dimensions
                    foreach (XElement subDimElement in dimCategories.Elements("Dimension"))
                    {
                        prohibited.Add(subDimElement.FirstAttribute.Value);
                    }
                    // Remove valid dimensions from the prohibitation list.
                    foreach (XElement subDimElement in dimCategories[1].Elements("Dimension"))
                    {
                        prohibited.Remove(subDimElement.FirstAttribute.Value);
                    }
                    foreach (string dimension in TimeDimensions())
                    {
                        prohibited.Remove(dimension);
                    }
                    foreach (XElement subMetricElement in metCategories[6].Elements("Metric"))
                    {
                        prohibited.Add(subMetricElement.FirstAttribute.Value);
                    }
                    prohibited.Add("visitors");

                }
            }

            /*********************************** M3. Content  ***********************************************/
            // Prohibits D7. Events
            if (metric.Equals("unique page views"))
            {
                foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                {
                    prohibited.Add(subDimElement.FirstAttribute.Value);
                }
                prohibited.Add("visitors");
            }

            /*********************************************** M4. Ecommerce **********************************/
            //
            bool checkedStatus = false;
            foreach (XElement subMetElement in metCategories[3].Elements("Metric"))
            {
                if (subMetElement.FirstAttribute.Value.Equals(metric))
                {
                    checkedStatus = true;
                }
            }
            if (checkedStatus)
            {
                prohibited.Add("visitors");
            }

            /******************************************** M5. Internal Search *******************************/
            foreach (XElement subMetElement in metCategories[4].Elements("Metric"))
            {
                if (subMetElement.FirstAttribute.Value.Equals(metric))
                {
                    foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                    {
                        prohibited.Add(subDimElement.FirstAttribute.Value);
                    }
                    prohibited.Add("visitors");
                }
            }

            /*************************************** M6. Goals **********************************************/
            foreach (XElement subMetElement in metCategories[5].Elements("Metric"))
            {
                if (subMetElement.FirstAttribute.Value.Equals(metric))
                {
                    foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                    {
                        prohibited.Add(subDimElement.FirstAttribute.Value);
                    }
                    prohibited.Add("visitors");
                }
            }

            /*************************************** M7. Events *****************************************/
            foreach (XElement subMetElement in metCategories[6].Elements("Metric"))
            {
                if (subMetElement.FirstAttribute.Value.Equals(metric))
                {
                    foreach (XElement subMetricElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetricElement.FirstAttribute.Value);
                    }

                    prohibited.Add("exit page path");
                    prohibited.Add("landing page path");
                    prohibited.Add("second page path");
                    prohibited.Add("visitors");
                }
            }

            return prohibited;
        }
        /*

         */
        public List<string> MultiCombo(List<string> input)
        {
            XmlLoader loader = new XmlLoader();
            loader.Loader();
            metCategories = loader.MetCategories;
            dimCategories = loader.DimCategories;

            List<string> metDimCombo = new List<string>();
            List<string> comboHelperOne = new List<string>();
            List<string> comboHelperTwo = new List<string>();

            /************************ If query contains ga:visitors *****************************/
            if (input.ToString().Contains("visitors"))
            {
                // Invalidates all metrics.
                foreach (XElement subMetElement in metCategories.Elements("Metric"))
                {
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);
                }

                // Re-validates M1. Visitors
                foreach (XElement subMetElement in metCategories[0].Elements("Metric"))
                {
                    metDimCombo.Remove(subMetElement.FirstAttribute.Value);
                }

                foreach (string metric in TimeDimensions())
                {
                    metDimCombo.Remove(metric);
                }
            }

            if (comboHelperOne.Count > 0 && comboHelperTwo.Count < 1)
            {
                // Prohibits M2. Campaign
                foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                {
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);
                }
                // Prohibits M7. Events
                foreach (XElement subMetElement in metCategories[6].Elements("Metric"))
                {
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);
                }
                metDimCombo.Add("time on site");
                metDimCombo.Add("visits");
                metDimCombo.Add("visitors");

                // Prohibits D2. Campaign
                foreach (XElement subDimElement in dimCategories[1].Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

                // Prohibits D4.
                foreach (XElement subDimElement in dimCategories[3].Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

                // Prohibits D7.
                foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

            }

            comboHelperOne.Clear();
            comboHelperTwo.Clear();

            /************************** Any M2. Campaign AND/OR ga:adContent, ga:adSlot and ga:adSlotPosition *******************************************/

            // If the input string contains all these three values then a multi-combination is selected.
            multiCombo = comboMulti(input);

            // This block of code validates the metrics allowed.
            if (multiCombo)
            {
                // Invalidates all M7. Events.
                foreach (XElement subMetElement in metCategories[6].Elements("Metric"))
                {
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);
                }

                metDimCombo.Add("visitors");

                // Prohibit all dimensions
                foreach (XElement subDimElement in dimCategories.Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

                // Remove the valid combination D2. Campaign from the prohibitation list.
                foreach (XElement subDimElement in dimCategories[1].Elements("Dimension"))
                {
                    metDimCombo.Remove(subDimElement.FirstAttribute.Value);
                }

                // Remove the valid time dimension combinations
                foreach (string dimension in TimeDimensions())
                {
                    metDimCombo.Remove(dimension);
                }
            }

            // Clears the helper lists
            comboHelperOne.Clear();
            comboHelperTwo.Clear();
            multiCombo = false;

            /********************** Any D3. Content AND D2. Campaign, except ga:adContent, ga:adSlot and ga:adSlotPosition ****************************/
            foreach (string dimension in input)
            {
                foreach (XElement subDimElement in dimCategories[2].Elements("Dimension"))
                {
                    if (subDimElement.FirstAttribute.Value.Equals(dimension))
                        comboHelperOne.Add(subDimElement.FirstAttribute.Value);
                }

                foreach (XElement subDimElement in dimCategories[1].Elements("Dimension"))
                {
                    if (subDimElement.FirstAttribute.Value.Equals(dimension) && !dimension.Equals("ad content") && !dimension.Equals("ad slot") && !dimension.Equals("ad slotposition"))
                        comboHelperTwo.Add(subDimElement.FirstAttribute.Value);
                }
            }

            if (comboHelperOne.Count > 0 && comboHelperTwo.Count > 0)
            {
                foreach (XElement subDimElement in dimCategories[3].Elements("Dimension"))
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);

                foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);

                metDimCombo.Add("ad content");
                metDimCombo.Add("ad slot");
                metDimCombo.Add("ad slot position");

                foreach (XElement subMetElement in metCategories[0].Elements("Metric"))
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);

                metDimCombo.Remove("time on site");
                metDimCombo.Remove("visitors");
                metDimCombo.Remove("visits");

                foreach (XElement subMetElement in metCategories[2].Elements("Metric"))
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);

                foreach (XElement subMetElement in metCategories[4].Elements("Metric"))
                    metDimCombo.Add(subMetElement.FirstAttribute.Value);
            }

            // Clears the helper lists
            comboHelperOne.Clear();
            comboHelperTwo.Clear();
            multiCombo = false;

            /**************************** Only D3. Content (any from the group) ********************************/
            foreach (string dimension in input)
            {
                foreach (XElement subDimElement in dimCategories[2].Elements("Dimension"))
                {
                    if (subDimElement.FirstAttribute.Value.Equals(dimension))
                        comboHelperOne.Add(subDimElement.FirstAttribute.Value);
                }
            }

                if (comboHelperOne.Count > 0 && comboHelperOne.Count == input.Count)
                {
                    foreach (XElement subDimElement in dimCategories[1].Elements("Dimension"))
                    {
                        metDimCombo.Add(subDimElement.FirstAttribute.Value);
                    }

                    foreach (XElement subDimElement in dimCategories[3].Elements("Dimension"))
                    {
                        metDimCombo.Add(subDimElement.FirstAttribute.Value);
                    }

                    foreach (XElement subDimElement in dimCategories[4].Elements("Dimension"))
                    {
                        metDimCombo.Add(subDimElement.FirstAttribute.Value);
                    }

                    foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                    {
                        metDimCombo.Add(subDimElement.FirstAttribute.Value);
                    }
                }

                // Clears the helper lists
                comboHelperOne.Clear();
                comboHelperTwo.Clear();
                multiCombo = false;

            /*************************** Any D7. Event AND/OR ga:adContent, ga:adSlot and ga:adSlotPosition *************************************/
            multiCombo = comboMulti(input);

            foreach (string dimension in input)
            {
                foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
                {
                    if (subDimElement.FirstAttribute.Value.Equals(dimension))
                    {
                        comboHelperOne.Add(subDimElement.FirstAttribute.Value);
                    }
                }
            }

            if ((comboHelperOne.Count > 0 && multiCombo) || multiCombo)
            {
                // Invalidates prohibited dimensions.

                // D3.
                foreach (XElement subDimElement in dimCategories[2].Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

                // D4.
                foreach (XElement subDimElement in dimCategories[3].Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

                // D5.
                foreach (XElement subDimElement in dimCategories[4].Elements("Dimension"))
                {
                    metDimCombo.Add(subDimElement.FirstAttribute.Value);
                }

                // ga:pagePath and ga:pageTitle
                metDimCombo.Add("page path");
                metDimCombo.Add("page title");
            }

            // Clears the helper lists
            comboHelperOne.Clear();
            comboHelperTwo.Clear();
            multiCombo = false;

            // Prohibited dimensions and metrics are returned.
            return metDimCombo;
        }
        // Method called from QueryBuilder
        public List<string> prohibitedMetrics(string dimension)
        {
            XmlLoader loader = new XmlLoader();
            loader.Loader();
            dimItem = dimension;
            dimCategories = loader.DimCategories;
            metCategories = loader.MetCategories;

            // D1. Visitor
            foreach (XElement subDimElement in dimCategories[0].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension) && TimeDimensions(dimension))
                {
                    // Disable ga:visitors and M2. Campaign
                    foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                    prohibited.Add("visitors");
                }
            }

            // D2. Campaign
            foreach (XElement subDimElement in dimCategories[1].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension))
                {
                    prohibited.Add("visitors");
                    break;
                }
            }

            // D3. Content, only for ga:exitPagePath ga:landingPagePath ga:secondPagePath
            if (dimension.Contains("exit page path") || dimension.Contains("landing page path") || dimension.Contains("second page path"))
            {
                foreach (XElement subDimElement in dimCategories[2].Elements("Dimension"))
                {
                    if (subDimElement.FirstAttribute.Value.Equals(dimension))
                    {
                        prohibited.Add("time on site");
                        prohibited.Add("visitors");
                        prohibited.Add("visits");

                        // Disable M2. Campaign and M7. Events
                        foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                        {
                            prohibited.Add(subMetElement.FirstAttribute.Value);
                        }
                        foreach (XElement subMetElement in metCategories[6].Elements("Metric"))
                        {
                            prohibited.Add(subMetElement.FirstAttribute.Value);
                        }

                        // Prohibits D2. Campaign
                        foreach (XElement subDimensionElement in dimCategories[1].Elements("Dimension"))
                        {
                            prohibited.Add(subDimensionElement.FirstAttribute.Value);
                        }

                        // Prohibits D4. Ecommerce
                        foreach (XElement subDimensionElement in dimCategories[3].Elements("Dimension"))
                        {
                            prohibited.Add(subDimensionElement.FirstAttribute.Value);
                        }

                        // Prohibits D5. Internal Search
                        foreach (XElement subDimensionElement in dimCategories[4].Elements("Dimension"))
                        {
                            prohibited.Add(subDimensionElement.FirstAttribute.Value);
                        }

                        // Prohibits D7. Events
                        foreach (XElement subDimensionElement in dimCategories[6].Elements("Dimension"))
                        {
                            prohibited.Add(subDimensionElement.FirstAttribute.Value);
                        }
                    }
                }
            }
            // D3. Content, excluding ga:exitPagePath ga:landingPagePath ga:secondPagePath
            else
            {
                foreach (XElement subDimElement in dimCategories[2].Elements("Dimension"))
                {
                    if (subDimElement.FirstAttribute.Value.Equals(dimension))
                    {
                        foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                        {
                            prohibited.Add(subMetElement.FirstAttribute.Value);
                        }
                        prohibited.Add("visitors");
                    }
                }
            }

            //D4. Ecommerce
            foreach (XElement subDimElement in dimCategories[3].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension))
                {
                    // Disable ga:visitors
                    prohibited.Add("visitors");
                    //Disable M2. Campaign.
                    foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                }
            }

            //D5. Internal Search
            foreach (XElement subDimElement in dimCategories[4].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension))
                {
                    // Disable ga:visitors
                    prohibited.Add("visitors");
                    //Disable M2. Campaign.
                    foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                }
            }

            //D6. Custom Variables
            foreach (XElement subDimElement in dimCategories[5].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension))
                {
                    // Disable ga:visitors
                    prohibited.Add("visitors");
                    //Disable M2. Campaign.
                    foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                }
            }

            //D7. Events
            foreach (XElement subDimElement in dimCategories[6].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension))
                {
                    // Invalidate ga:visitors
                    prohibited.Add("visitors");

                    // Invalidate M2. Campaign.
                    foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                    // Invalidate M3.
                    foreach (XElement subMetElement in metCategories[2].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                    // Invalidate M5.
                    foreach (XElement subMetElement in metCategories[4].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                    // Invalidate M6.
                    foreach (XElement subMetElement in metCategories[5].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                }
            }

            //D8. AdWords
            foreach (XElement subDimElement in dimCategories[7].Elements("Dimension"))
            {
                if (subDimElement.FirstAttribute.Value.Equals(dimension))
                {
                    // Disable ga:visitors
                    prohibited.Add("visitors");
                    //Disable M2. Campaign.
                    foreach (XElement subMetElement in metCategories[1].Elements("Metric"))
                    {
                        prohibited.Add(subMetElement.FirstAttribute.Value);
                    }
                }
            }

            return prohibited;
        }