/// <summary>
    /// This method reads the incoming message and decides on to which message count needs to be updated.
    /// This method invokes another method to write the count to file
    /// </summary>
    /// <param name="message">ReceivedSMS, message received from Request</param>
    private void SaveMessageCount(ReceivedSMS message)
    {
        if (!string.IsNullOrEmpty(message.Message))
        {
            string messageText = message.Message.Trim().ToLower();

            string filePathConfigKey = string.Empty;
            switch (messageText)
            {
            case "basketball":
                filePathConfigKey = "BasketBallFilePath";
                break;

            case "football":
                filePathConfigKey = "FootBallFilePath";
                break;

            case "baseball":
                filePathConfigKey = "BaseBallFilePath";
                break;
            }

            if (!string.IsNullOrEmpty(filePathConfigKey))
            {
                this.WriteToFile(filePathConfigKey);
            }
        }
    }
    /// <summary>
    /// This method reads the incoming message and decides on to which message count needs to be updated.
    /// This method invokes another method to write the count to file
    /// </summary>
    /// <param name="message">ReceivedSMS, message received from Request</param>
    private void SaveMessageCount(ReceivedSMS message)
    {
        if (!string.IsNullOrEmpty(message.Message))
        {
            string messageText = message.Message.Trim().ToLower();

            string filePathConfigKey = string.Empty;
            switch (messageText)
            {
                case "basketball":
                    filePathConfigKey = "BasketBallFilePath";
                    break;
                case "football":
                    filePathConfigKey = "FootBallFilePath";
                    break;
                case "baseball":
                    filePathConfigKey = "BaseBallFilePath";
                    break;
            }

            if (!string.IsNullOrEmpty(filePathConfigKey))
            {
                this.WriteToFile(filePathConfigKey);
            }
        }
    }
    /// <summary>
    /// This method called when the page is loaded into the browser. This method requests input stream and parses it to get message counts.
    /// </summary>
    /// <param name="sender">object, which invoked this method</param>
    /// <param name="e">EventArgs, which specifies arguments specific to this method</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        System.IO.Stream stream = Request.InputStream;

        if (null != stream)
        {
            ReceivedSMS message = RequestFactory.GetSMS(stream);
            if (null != message)
            {
                this.SaveMessageCount(message);
                this.SaveMessage(message);
            }
        }
    }
    /// <summary>
    /// This method reads the incoming message and stores the received message details.
    /// </summary>
    /// <param name="message">ReceivedSMS, message received from Request</param>
    private void SaveMessage(ReceivedSMS message)
    {
        string filePath = ConfigurationManager.AppSettings["MessagesFilePath"];

        string messageLineToStore = message.DateTime.ToString() + "_-_-" +
                                    message.MessageId.ToString() + "_-_-" +
                                    message.Message.ToString() + "_-_-" +
                                    message.SenderAddress.ToString() + "_-_-" +
                                    message.DestinationAddress.ToString();

        using (StreamWriter streamWriter = File.AppendText(Request.MapPath(filePath)))
        {
            streamWriter.WriteLine(messageLineToStore);
            streamWriter.Close();
        }
    }
    /// <summary>
    /// This method reads the incoming message and stores the received message details.
    /// </summary>
    /// <param name="message">ReceivedSMS, message received from Request</param>
    private void SaveMessage(ReceivedSMS message)
    {
        string filePath = ConfigurationManager.AppSettings["MessagesFilePath"];

        string messageLineToStore = message.DateTime.ToString() + "_-_-" +
                                    message.MessageId.ToString() + "_-_-" +
                                    message.Message.ToString() + "_-_-" +
                                    message.SenderAddress.ToString() + "_-_-" +
                                    message.DestinationAddress.ToString();

        using (StreamWriter streamWriter = File.AppendText(Request.MapPath(filePath)))
        {
            streamWriter.WriteLine(messageLineToStore);
            streamWriter.Close();
        }
    }