/// <summary>
        /// Renders the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="result">The result.</param>
        public override void Render(Context context, TextWriter result)
        {
            // First, ensure that this command is allowed in the context.
            if (!LavaHelper.IsAuthorized(context, this.GetType().Name))
            {
                result.Write(string.Format(RockLavaBlockBase.NotAuthorizedMessage, this.Name));
                base.Render(context, result);
                return;
            }

            // Parse the Lava Command markup to retrieve paramters.
            var parms = new Dictionary <string, string>
            {
                { ParameterKey.Operation, "View" }
            };

            LavaHelper.ParseCommandMarkup(_markup, context, parms);

            // Set local variables from parsed parameters.
            int?contentChannelItemId = parms.GetValueOrNull(ParameterKey.ContentChannelItemId).AsIntegerOrNull();

            if (!contentChannelItemId.HasValue)
            {
                // Do nothing if a ContentChannelItem ID wasn't specified.
                return;
            }

            ContentChannelItem contentChannelItem = null;

            using (var rockContext = new RockContext())
            {
                contentChannelItem = new ContentChannelItemService(rockContext)
                                     .Queryable("ContentChannel")
                                     .AsNoTracking()
                                     .FirstOrDefault(c => c.Id == contentChannelItemId.Value);
            }

            ContentChannel contentChannel = contentChannelItem.ContentChannel;

            if (contentChannelItem == null || contentChannel == null)
            {
                // The caller supplied an invalid ContentChannelItem ID; nothing to do.
                return;
            }

            string operation = parms.GetValueOrNull(ParameterKey.Operation);
            string summary   = parms.GetValueOrNull(ParameterKey.Summary);
            string source    = parms.GetValueOrNull(ParameterKey.Source);
            string medium    = parms.GetValueOrNull(ParameterKey.Medium);
            string campaign  = parms.GetValueOrNull(ParameterKey.Campaign);
            string content   = parms.GetValueOrNull(ParameterKey.Content);
            string term      = parms.GetValueOrNull(ParameterKey.Term);

            int?personAliasId = parms.GetValueOrNull(ParameterKey.PersonAliasId).AsIntegerOrNull();

            if (!personAliasId.HasValue)
            {
                Person currentPerson = LavaHelper.GetCurrentPerson(context);
                personAliasId = LavaHelper.GetPrimaryPersonAliasId(currentPerson);
            }

            // Write the Interaction by way of a transaction.
            DefinedValueCache mediumType = DefinedValueCache.Get(Rock.SystemGuid.DefinedValue.INTERACTIONCHANNELTYPE_CONTENTCHANNEL.AsGuid());

            if (mediumType == null)
            {
                return;
            }

            var info = new InteractionTransactionInfo
            {
                ChannelTypeMediumValueId = mediumType.Id,
                ChannelEntityId          = contentChannel.Id,
                ChannelName           = contentChannel.ToString(),
                ComponentEntityTypeId = contentChannel.TypeId,
                ComponentEntityId     = contentChannelItem.Id,
                ComponentName         = contentChannelItem.ToString(),
                InteractionOperation  = operation,
                InteractionSummary    = summary ?? contentChannelItem.Title,
                PersonAliasId         = personAliasId,
                InteractionSource     = source,
                InteractionMedium     = medium,
                InteractionCampaign   = campaign,
                InteractionContent    = content,
                InteractionTerm       = term
            };

            var interactionTransaction = new InteractionTransaction(info);

            interactionTransaction.Enqueue();
        }