/// <summary>
        /// See https://our.umbraco.org/documentation/Reference/Events/ for event handling documentation.
        /// </summary>
        /// <param name="umbracoApplication"></param>
        /// <param name="applicationContext"></param>
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            queueConnection = new SqlConnection(applicationContext.DatabaseContext.ConnectionString);

            /*
            ContentService
            MediaService
            ContentTypeService
            MemberService
            FileService
            LocalizationService
            DataTypeService
            */

            var contentQueue = new ContentQueue(queueConnection);
            ContentService.Saved += contentQueue.ContentService_Saved;

            var mediaQueue = new MediaQueue(queueConnection);
            MediaService.Saved += mediaQueue.MediaService_Saved;
            MediaService.Deleted += mediaQueue.MediaService_Deleted;

            var memberQueue = new MemberQueue(queueConnection);
            MemberService.Created += memberQueue.MemberService_Created;

            base.ApplicationStarted(umbracoApplication, applicationContext);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="conn"></param>
        private static void ProcessContentQueue(SqlConnection conn)
        {
            Console.WriteLine("Checking Content Queue...");
            SqlTransaction tran = conn.BeginTransaction();

            var queue = new ContentQueue(conn);
            SqlCommand command = queue.CreateReadCommand(tran);

            int rows = command.ExecuteNonQuery();
            if (rows > 0)
            {
                var bodyXml = (System.Data.SqlTypes.SqlXml)command.Parameters["@message_body"].SqlValue;
                if (!bodyXml.IsNull)
                {
                    string messageType = (string)command.Parameters["@message_type"].Value;
                    Console.WriteLine(" -> Message: [" + messageType + "]");
                    switch (messageType)
                    {
                        case "//Recommendations/UpdateBlogPostMessage":
                            XElement messageBodyXml = XElement.Parse(bodyXml.Value);
                            string nodeType = messageBodyXml.Elements().Where(p => p.Name == "nodeType").First().Value;
                            string summary = messageBodyXml.Elements().Where(p => p.Name == "summary").First().Value;
                            var nodeId = int.Parse(messageBodyXml.Elements().Where(p => p.Name == "nodeId").First().Value);

                            Console.WriteLine("     -> nodeId = {0}, nodeType = {1}, summary = {2}", nodeId, nodeType, summary);
                            /* Do whatever needs to be done with the Recommendations API using nodeType, summary and NodeId. */

                            tran.Commit();
                            break;

                        default:
                            tran.Rollback();
                            throw new InvalidOperationException("Unknown message type " + messageType);
                    }
                }
            }
            else
            {
                tran.Rollback();
            }
        }