private static void UpdateUserPictures(IRepository consoleRepository)
        {
            Dictionary <String, byte[]> userPictures = DatabaseInit.GetUserPictures();

            foreach (User u in consoleRepository.Query <User>(u => u.IsActive))
            {
                String shortName = WebSiteModuleManager.ExtractUserName(u.DomainLogon);
                if (userPictures.ContainsKey(shortName))
                {
                    byte[] userPic = userPictures[shortName];
                    if ((userPic != null) && (userPic.Length > 0))
                    {
                        if ((u.UserThumbnail == null) || (u.UserThumbnail.Length <= 0))
                        {
                            u.UserThumbnail = userPic;
                        }
                        else
                        {
                            if (!u.UserThumbnail.Equals(userPic))
                            {
                                u.UserThumbnail = userPic;
                            }
                        }
                    }
                }
            }
        }
        private static void UpdateSipAddresses(IRepository consoleRepository)
        {
            Dictionary <String, String> userSipAddresses = DatabaseInit.GetUserSipAddresses();

            foreach (User u in consoleRepository.Query <User>(u => u.IsActive))
            {
                String shortName = WebSiteModuleManager.ExtractUserName(u.DomainLogon);
                if (userSipAddresses.ContainsKey(shortName))
                {
                    String sipAddress = userSipAddresses[shortName];
                    if (String.IsNullOrEmpty(u.SipAddress))
                    {
                        if (!String.IsNullOrEmpty(sipAddress))
                        {
                            u.SipAddress = sipAddress;
                        }
                    }
                    else
                    {
                        if (!u.SipAddress.Equals(sipAddress, StringComparison.InvariantCultureIgnoreCase))
                        {
                            u.SipAddress = sipAddress;
                        }
                    }
                }
            }
        }
        public static void SyncSemiStaticData()
        {
            DatabaseInit._LogHandler.WriteLog("SyncSemiStaticData()", LogSeverity.Information, LogCategory.DataAccess);

            using (var httpHandler = new HttpClientHandler())
            {
                httpHandler.UseDefaultCredentials = true;

                using (var httpClient = new HttpClient(httpHandler))
                {
                    httpClient.BaseAddress = new Uri(Properties.Settings.Default.ServicesHostUrl);
                    httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));

                    using (var consoleRepository = new ConsoleRepository())
                    {
                        DatabaseInit.SyncBrokers(httpClient, consoleRepository);
                        DatabaseInit.SyncNonLondonBrokers(httpClient, consoleRepository);
                        DatabaseInit.SyncCOBs(httpClient, consoleRepository);
                        DatabaseInit.SyncOffices(httpClient, consoleRepository);
                        DatabaseInit.SyncUnderwriters(httpClient, consoleRepository);
                        DatabaseInit.SyncRiskCodes(httpClient, consoleRepository);

                        DatabaseInit.UpdateSipAddresses(consoleRepository);
                        DatabaseInit.UpdateEmailAddresses(consoleRepository);
                        DatabaseInit.UpdateUserPictures(consoleRepository);

                        consoleRepository.SaveChanges();
                    }
                }
            }
        }