/// <summary>
        /// Initializes a new instance of the <see cref="Craswell.WebRepositories.Tangerine.TangerineRepository"/> class.
        /// </summary>
        /// <param name="name">The repository name.</param>
        /// <param name="tangerineClient>The tangerine client.</param>
        public TangerineRepository(
            int id,
            string name,
            TangerineClient tangerineClient)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (tangerineClient == null)
            {
                throw new ArgumentNullException("tangerineClient");
            }

            this.id = id;
            this.name = name;
            this.tangerineClient = tangerineClient;
        }
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.tangerineClient != null)
         {
             this.tangerineClient.Dispose();
             this.tangerineClient = null;
         }
     }
 }
        /// <summary>
        /// Gets the web repositories.
        /// </summary>
        /// <returns>The web repositories.</returns>
        public IList<IConnectedWebRepository> GetWebRepositories()
        {
            List<IConnectedWebRepository> repositoryList = new List<IConnectedWebRepository>();

            using (ISession session = this.dal.OpenSession())
            {
                IList<WebRepositoryData> webRepositories = session
                    .CreateCriteria<WebRepositoryData>()
                    .List<WebRepositoryData>();

                foreach (WebRepositoryData repository in webRepositories)
                {
                    switch (repository.Type)
                    {
                        case WebRepositoryType.Tangerine:
                            ILog tangerineLogger = LogManager.GetLogger("TangerineClientLogger");

                            TangerineConfiguration config = new TangerineConfiguration(
                                repository.Configuration.Address,
                                this.aesTool.DecryptText(repository.Configuration.Username, this.passphrase),
                                this.aesTool.DecryptText(repository.Configuration.Password, this.passphrase),
                                repository.Configuration.SecurityQuestions
                                .ToDictionary(
                                    sq => this.aesTool.DecryptText(sq.Key, this.passphrase),
                                    sq => this.aesTool.DecryptText(sq.Value, this.passphrase)));

                            HttpClient httpClient = new HttpClient(tangerineLogger);

                            TangerineObjectFactory objectFactory = new TangerineObjectFactory();

                            TangerineClient client = new TangerineClient(
                                httpClient,
                                config,
                                objectFactory);

                            IConnectedWebRepository repo = new TangerineRepository(
                                repository.Id,
                                repository.Name,
                                client);

                            repositoryList.Add(repo);
                            break;
                    }
                }
            }

            return repositoryList;
        }