//

        //Get Tag Item data
        public JsonResult GetTagItemData(string searchType, string entityType, int recordID, int maxRecords = 10)
        {
            try
            {
                var data = SearchServices.GetTagSet(searchType, (SearchServices.TagTypes)Enum.Parse(typeof(SearchServices.TagTypes), entityType, true), recordID, maxRecords);
                return(JsonHelper.GetJsonWithWrapper(data, true, "", null));
            }
            catch
            {
                return(JsonHelper.GetJsonWithWrapper(null, false, "Invalid entity type", null));
            }
        }
        //Get Tag Item Data (Used with V2 tag items)
        public JsonResult GetTagsV2Data(string AjaxQueryName, int RecordId, string SearchType, string TargetEntityType, int MaxRecords = 10)
        {
            try
            {
                var tagType = (SearchServices.TagTypes)Enum.Parse(typeof(SearchServices.TagTypes), TargetEntityType, true);
                var data    = SearchServices.GetTagSet(SearchType, tagType, RecordId, MaxRecords);
                var items   = new List <SearchTagItem>();

                switch (AjaxQueryName)
                {
                case "GetSearchResultCompetencies":
                {
                    items = data.Items.ConvertAll(m => new SearchTagItem()
                        {
                            Display     = string.IsNullOrWhiteSpace(m.Description) ? m.Label : "<b>" + m.Label + "</b>" + System.Environment.NewLine + m.Description,
                            QueryValues = new Dictionary <string, object>()
                            {
                                { "SchemaName", m.Schema },
                                { "CodeId", m.CodeId },
                                { "TextValue", m.Label },
                                { "TextDescription", m.Description }
                            }
                        });
                    break;
                }

                case "GetSearchResultCosts":
                {
                    items = data.CostItems.ConvertAll(m => new SearchTagItem()
                        {
                            Display     = m.CostType + ": " + m.CurrencySymbol + m.Price + " ( " + (m.SourceEntity ?? "direct") + " )",
                            QueryValues = new Dictionary <string, object>()
                            {
                                { "CurrencySymbol", m.CurrencySymbol },
                                { "Price", m.Price },
                                { "CostType", m.CostType }
                            }
                            //Something that probably looks like that -^
                        });
                    break;
                }

                case "GetSearchResultPerformed":
                {
                    items = data.QAItems.ConvertAll(m => new SearchTagItem()
                        {
                            Display     = "<b>" + m.AgentToTargetRelationship + "</b> <b>" + m.TargetEntityType + "</b> " + m.TargetEntityName,
                            QueryValues = new Dictionary <string, object>()
                            {
                                { "SearchType", m.TargetEntityType.ToLower() },
                                { "RecordId", m.TargetEntityBaseId },
                                { "TargetEntityType", m.TargetEntityType },
                                { "IsReference", m.IsReference },
                                { "SubjectWebpage", m.TargetEntitySubjectWebpage },
                                { "TargetEntityTypeId", m.TargetEntityTypeId },
                                { "AssertionTypeId", m.AssertionTypeId }
                            }
                        });
                    break;
                }

                case "CredentialConnections":
                {
                    items = data.CostItems.ConvertAll(m => new SearchTagItem()
                        {
                            Display     = m.CostType + ": " + m.CurrencySymbol + m.Price + " ( " + (m.SourceEntity ?? "direct") + " )",
                            QueryValues = new Dictionary <string, object>()
                            {
                                { "CurrencySymbol", m.CurrencySymbol },
                                { "Price", m.Price },
                                { "CostType", m.CostType }
                            }
                            //Something that probably looks like that -^
                        });
                    break;
                }

                default:
                    break;
                }
                return(JsonHelper.GetJsonWithWrapper(items, true, "", null));
            }
            catch (Exception ex)
            {
                return(JsonHelper.GetJsonWithWrapper(null, false, ex.Message, null));
            }
        }