/// <summary>
 /// Enumerations the exists.
 /// </summary>
 /// <param name="agent">The agent.</param>
 /// <param name="id">The id.</param>
 /// <returns></returns>
 private bool EnumerationExists(IEnumerationRepositoryAgent agent, string id)
 {
     if (String.IsNullOrEmpty(id))
     {
         return(false);
     }
     return(agent.SelectById(id) != null);
 }
 /// <summary>
 /// Saves the enumeration.
 /// </summary>
 /// <param name="agent">The agent.</param>
 /// <param name="enumeration">The enumeration.</param>
 /// <returns></returns>
 private bool SaveEnumeration(IEnumerationRepositoryAgent agent, Enumeration enumeration)
 {
     if (EnumerationExists(agent, enumeration.Id))
     {
         return(true);
     }
     try
     {
         agent.Insert(enumeration);
         return(true);
     }
     catch (Exception ex)
     {
         _logger.Error("agent.Insert throws exception\n" + ex);
         return(false);
     }
 }
        /// <summary>
        /// Saves the enumeration.
        /// </summary>
        /// <param name="enumeration">The enumeration.</param>
        /// <returns></returns>
        private bool SaveEnumeration(Enumeration enumeration)
        {
            //if (EnumerationExists(enumeration.Id)) return true;
            if (_existingEnumerations.Select(en => en.Id).Contains(enumeration.Id))
            {
                return(true);
            }
            IEnumerationRepositoryAgent agent = ExplorerRepositoryAgentFactory.CreateEnumerationRepositoryAgent();

            try
            {
                agent.Insert(enumeration);
                return(true);
            }
            catch (Exception ex)
            {
                _logger.Error("agent.Insert throws exception\n" + ex);
                return(false);
            }
        }