public static void RefreshDBFollowers()
        {
            DatabaseContext context = new DatabaseContext();
            var             follows = TwitchHelpers.GetFollowers();
            int             id;
            string          key;
            ViewerStats     viewer    = new ViewerStats();
            NewViewerConfig newViewer = new NewViewerConfig();

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("This is experimental. Use at your own risk. Continue? Y/N");
            while (true)
            {
                key = Console.ReadLine();
                if (key.Equals("Y", StringComparison.InvariantCultureIgnoreCase))
                {
                    break;
                }
                if (key.Equals("N", StringComparison.InvariantCultureIgnoreCase))
                {
                    Console.WriteLine("Execution cancelled.");
                    Console.ResetColor();
                    return;
                }
                else
                {
                    Console.WriteLine("This is experimental. Use at your own risk. Continue? Y/N");
                }
            }


            for (int i = 0; i < follows.Result.Count - 1; i++)
            {
                id     = Convert.ToInt32(follows.Result[i].User.Id);
                viewer = new ViewerStats();
                viewer = context.ViewerStats.Where(x => x.TwitchID == id).FirstOrDefault();
                if (viewer == null)
                {
                    newViewer = new NewViewerConfig();
                    viewer    = newViewer.initViewer(follows.Result[i].User.Name, follows.Result[i].User.Id, follows.Result[i].CreatedAt.ToString(),
                                                     follows.Result[i].CreatedAt.ToString());

                    context.ViewerStats.Add(viewer);
                }
                else
                {
                    if (viewer.FirstSeen == null)
                    {
                        viewer.FirstSeen = follows.Result[i].CreatedAt.ToString();
                    }

                    viewer.FirstFollowed = follows.Result[i].CreatedAt.ToString();
                }
                Console.WriteLine(string.Format("{0} followed at: {1}", follows.Result[i].User.Name, follows.Result[i].CreatedAt));
            }
            Console.WriteLine("Saving... This may take a while.");
            context.SaveChanges();
            Console.WriteLine("Complete!");
            Console.ResetColor();
        }
        public void SetupDefaultCapabilities(
            UUID regionSeedID,
            Dictionary <string, string> capConfig,
            Dictionary <string, string> serviceURLs)
        {
            /* grid may override the caps through Cap_ ServiceURLs */
            foreach (KeyValuePair <string, string> kvp in serviceURLs)
            {
                if (kvp.Key.StartsWith("Cap_"))
                {
                    string capName = kvp.Key.Substring(4);
                    if (capName != "ChatSessionRequest")
                    {
                        m_ServiceURLCapabilities.Add(capName, kvp.Value);
                    }
                }
            }

            ChatSessionRequestCapability = new ChatSessionRequest(Agent, this, RemoteIP, ChatSessionRequestMethodHandlers);
            try
            {
                /* The LSLCompiler is the only one that has this method */
                /* there has to be LSLSyntaxId which contains the hash of the file as UUID */
                var compiler = CompilerRegistry.ScriptCompilers["lsl"];
                var mi       = compiler.GetType().GetMethod("GetLSLSyntaxId", Type.EmptyTypes);
                if (compiler.GetType().GetMethod("WriteLSLSyntaxFile", new Type[] { typeof(Stream) }) != null && mi != null)
                {
                    AddDefCapability("LSLSyntax", regionSeedID, Cap_LSLSyntax, capConfig);
                    m_ServiceURLCapabilities["LSLSyntaxId"] = (string)mi.Invoke(compiler, new object[0]);
                }
            }
            catch
            {
                /* no action needed here */
            }

            AddDefCapabilityFactory("SimulatorFeatures", regionSeedID, (agent) => new SimulatorFeatures(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapability("UpdateAgentLanguage", regionSeedID, Cap_UpdateAgentLanguage, capConfig);
            AddDefCapability("UntrustedSimulatorMessage", regionSeedID, Cap_UntrustedSimulatorMessage, capConfig);
            AddDefCapability("EnvironmentSettings", regionSeedID, Cap_EnvironmentSettings, capConfig);
            AddDefCapability("RenderMaterials", regionSeedID, Cap_RenderMaterials, capConfig);
            AddDefCapability("SimConsoleAsync", regionSeedID, Cap_SimConsoleAsyncCap, capConfig);
            /* AddDefCapability("ViewerAsset", regionSeedID, Cap_GetAsset, capConfig); TODO: rename needed */
            AddDefCapability("GetTexture", regionSeedID, Cap_GetAsset, capConfig);
            AddDefCapability("GetMesh", regionSeedID, Cap_GetAsset, capConfig);
            AddDefCapability("GetMesh2", regionSeedID, Cap_GetAsset, capConfig);
            AddDefCapability("GetDisplayNames", regionSeedID, Cap_GetDisplayNames, capConfig);
            AddDefCapability("MeshUploadFlag", regionSeedID, Cap_MeshUploadFlag, capConfig);
            AddDefCapability("GetPhysicsObjectData", regionSeedID, Cap_GetObjectsPhysicsData, capConfig);
            AddDefCapability("ChatSessionRequest", regionSeedID, ChatSessionRequestCapability.HttpRequestHandler, capConfig);
            string localHostName = string.Format("{0}://{1}:{2}", m_CapsRedirector.Scheme, m_CapsRedirector.ExternalHostName, m_CapsRedirector.Port);

            AddDefCapabilityFactory("DispatchRegionInfo", regionSeedID, (agent) => new DispatchRegionInfo(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("CopyInventoryFromNotecard", regionSeedID, (agent) => new CopyInventoryFromNotecard(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("ParcelPropertiesUpdate", regionSeedID, (agent) => new ParcelPropertiesUpdate(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("AgentPreferences", regionSeedID, (agent) => new AgentPreferences(agent, RemoteIP), capConfig);
            AddDefCapabilityFactory("ObjectAdd", regionSeedID, (agent) => new ObjectAdd(Server.Scene, agent.Owner, RemoteIP), capConfig);
            AddDefCapabilityFactory("UploadBakedTexture", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UploadBakedTexture(
                    agent.Owner,
                    Server.Scene.AssetService,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("NewFileAgentInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new NewFileAgentInventory(
                    agent,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("NewFileAgentInventoryVariablePrice", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new NewFileAgentInventoryVariablePrice(
                    agent,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateGestureAgentInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateGestureAgentInventory(
                    agent,
                    agent.InventoryService,
                    agent.AssetService,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateNotecardAgentInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateNotecardAgentInventory(
                    agent,
                    agent.InventoryService,
                    agent.AssetService,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateSettingsAgentInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateSettingsAgentInventory(
                    agent,
                    agent.InventoryService,
                    agent.AssetService,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateScriptAgent", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateScriptAgent(
                    agent,
                    agent.InventoryService,
                    agent.AssetService,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateScriptTask", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateScriptTask(
                    agent,
                    Server.Scene,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateGestureTaskInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateGestureTaskInventory(
                    agent,
                    Server.Scene,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateNotecardTaskInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateNotecardTaskInventory(
                    agent,
                    Server.Scene,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("UpdateSettingsTaskInventory", regionSeedID, (agent) =>
            {
                UploadAssetAbstractCapability capability = new UpdateSettingsTaskInventory(
                    agent,
                    Server.Scene,
                    localHostName,
                    RemoteIP);
                m_UploadCapabilities.Add(capability);
                return(capability);
            }, capConfig);
            AddDefCapabilityFactory("ParcelNavigateMedia", regionSeedID, (agent) => new ParcelNavigateMedia(agent.Owner, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("ObjectMedia", regionSeedID, (agent) => new ObjectMedia(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("ObjectMediaNavigate", regionSeedID, (agent) => new ObjectMediaNavigate(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("UpdateAvatarAppearance", regionSeedID, (agent) => new UpdateAvatarAppearance(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("LandResources", regionSeedID, (agent) => new LandResources(agent, Server.Scene, localHostName, RemoteIP), capConfig);
            AddDefCapabilityFactory("AttachmentResources", regionSeedID, (agent) => new AttachmentResources(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("ResourceCostSelected", regionSeedID, (agent) => new ResourceCostSelected(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("ViewerStats", regionSeedID, (agent) => ViewerStats     = new ViewerStats(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("ViewerMetrics", regionSeedID, (agent) => ViewerMetrics = new ViewerMetrics(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("GetObjectCost", regionSeedID, (agent) => new GetObjectCost(agent, Server.Scene, RemoteIP), capConfig);
            AddDefCapabilityFactory("EstateAccess", regionSeedID, (agent) => new EstateAccess(agent, Server.Scene, RemoteIP), capConfig);
        }