/// <exclude />
        public static void CancelFlowsByConsoleId(string consoleId)
        {
            List <string> serializedFlowTokens =
                (from f in DataFacade.GetData <IFlowInformation>()
                 where f.ConsoleId == consoleId
                 select f.SerializedFlowToken).ToList();

            foreach (string serializedFlowToken in serializedFlowTokens)
            {
                FlowToken flowToken = FlowTokenSerializer.Deserialize(serializedFlowToken);

                CancelFlow(flowToken);
            }
        }
        /// <exclude />
        public static IEnumerable <FlowToken> GetFlowTokensByUsername(string username)
        {
            List <string> serializedFlowTokens =
                (from f in DataFacade.GetData <IFlowInformation>()
                 where f.Username == username
                 select f.SerializedFlowToken).ToList();

            foreach (string serializedFlowToken in serializedFlowTokens)
            {
                FlowToken flowToken = FlowTokenSerializer.Deserialize(serializedFlowToken);

                yield return(flowToken);
            }
        }
        /// <exclude />
        public static void Scavenge()
        {
            Log.LogVerbose(LogTitle, "Starting scavenger run");

            List <IFlowInformation> flowInformations = DataFacade.GetData <IFlowInformation>().ToList();

            // NOTE: Low performance implementation
            foreach (IFlowInformation flowInformation in flowInformations)
            {
                TimeSpan timeSpan = DateTime.Now - flowInformation.TimeStamp;
                if (timeSpan > Timeout)
                {
                    FlowToken flowToken = null;
                    string    flowTokenStr;

                    try
                    {
                        flowToken = FlowTokenSerializer.Deserialize(flowInformation.SerializedFlowToken);

                        flowTokenStr = flowToken.ToString();
                    }
                    catch (Exception)
                    {
                        flowTokenStr = flowInformation.SerializedFlowToken ?? string.Empty;
                        if (flowTokenStr.Length > 200)
                        {
                            flowTokenStr = flowTokenStr.Substring(0, 200);
                        }
                    }

                    Log.LogVerbose(LogTitle, "Scavenging flow started by username '{0}', flow = '{1}'".FormatWith(flowInformation.Username, flowTokenStr));

                    DataFacade.Delete <IFlowInformation>(flowInformation);

                    if (flowToken != null)
                    {
                        FlowControllerFacade.CancelFlow(flowToken);
                    }
                }
            }
        }