public string SaveQuoteTemplatesForTeam(TeamQuoteTemplatesDto teamQuoteTemplatesDto)
        {
            using (ConsoleRepository)
            {
                // Check does Team Links exist
                var team =
                    ConsoleRepository.Query<Team>(t => t.Id == teamQuoteTemplatesDto.TeamId,
                                                  t => t.RelatedQuoteTemplates).FirstOrDefault();

                var quoteTemplatesChanged = false;
                if (team != null)
                {
                    // Remove links that need to be removed
                    var currentTeamQuoteTemplates = team.RelatedQuoteTemplates.Select(qt => qt.Id).ToList();

                    var quoteTemplatesToRemove =
                        currentTeamQuoteTemplates.Except(teamQuoteTemplatesDto.TeamQuoteTemplatesIdList ??
                                                         new List<int>()).ToList();

                    foreach (var quoteTemplateId in quoteTemplatesToRemove)
                    {
                        var quoteTemplateToDelete =
                            ConsoleRepository.Query<QuoteTemplate>().FirstOrDefault(qt => qt.Id == quoteTemplateId);

                        if (quoteTemplateToDelete != null &&
                            team.RelatedQuoteTemplates.Any(qt => qt.Equals(quoteTemplateToDelete)))
                        {
                            team.RelatedQuoteTemplates.Remove(quoteTemplateToDelete);
                            quoteTemplatesChanged = true;
                        }
                    }

                    // Add Links that need to be added
                    foreach (var quoteTemplateId in teamQuoteTemplatesDto.TeamQuoteTemplatesIdList ?? new List<int>())
                    {
                        if (team.RelatedQuoteTemplates.Any(qt => qt.Id == quoteTemplateId)) continue;
                        var quoteTemplateToAdd =
                            ConsoleRepository.Query<QuoteTemplate>().FirstOrDefault(qt => qt.Id == quoteTemplateId);

                        team.RelatedQuoteTemplates.Add(quoteTemplateToAdd);
                        quoteTemplatesChanged = true;
                    }

                    ConsoleRepository.SaveChanges();

                    if (quoteTemplatesChanged)
                        return "Saved QuoteTemplate(s) for Team";
                    else
                        return "QuoteTemplate(s) for Team have not changed";
                }
                else
                {
                    return "Save QuoteTemplates - Team does not Exist";
                }
            }
        }
        public ActionResult SaveQuoteTemplatesForTeam(TeamQuoteTemplatesDto teamQuoteTemplatesDto)
        {
            try
            {
                var result = _adminModuleManager.SaveQuoteTemplatesForTeam(teamQuoteTemplatesDto);

                return new JsonNetResult
                {
                    Data = result
                };
            }
			catch (Exception ex) // TODO: Remove
            {
                _logHandler.WriteLog(ex.ToString(), LogSeverity.Error, LogCategory.BusinessComponent);
                throw new HttpException(500, "Server Error");
            }
        }