public ActionResult Index(string id)
    {
        object model = CompositionRoot.DocumentSession.Load <object>(id);

        if (model is IAuditLogCapable capable)
        {
            FormattedAuditLog history = capable.GetFormattedAuditLog(CompositionRoot.DocumentSession);
            return(View(history));
        }

        return(View(FormattedAuditLog.Empty));
    }
    protected override async Task <UpdateRosterEmail> CreateEmail(HandlerContext <Command> context)
    {
        Roster roster = CompositionRoot.DocumentSession
                        .Include <Roster>(x => x.Players)
                        .Load <Roster>(context.Payload.RosterId);
        FormattedAuditLog formattedAuditLog = roster.GetFormattedAuditLog(
            CompositionRoot.DocumentSession,
            context.CorrelationId);

        Player[] players    = CompositionRoot.DocumentSession.Load <Player>(roster.Players);
        string   teamLeader =
            roster.TeamLeader != null
            ? CompositionRoot.DocumentSession.Load <Player>(roster.TeamLeader).Name
            : string.Empty;

        bool needsAccept = roster.AcceptedPlayers.Contains(context.Payload.PlayerId) == false;

        UpdateRosterEmail_State.MatchHeadType matchHead;
        if (roster.BitsMatchId != 0)
        {
            Bits_VMatchHeadInfo matchHeadInfo = await context.Databases.Bits.VMatchHeadInfo.SingleAsync(
                x => x.ExternalMatchId == roster.BitsMatchId);

            matchHead = new(
                "Hemmalag",
                matchHeadInfo.HomeTeamAlias,
                "Bortalag",
                matchHeadInfo.AwayTeamAlias,
                matchHeadInfo.HallName,
                matchHeadInfo.OilProfileId,
                matchHeadInfo.OilProfileName,
                matchHeadInfo.MatchDateTime);
        }
        else
        {
            matchHead = new(
                "Lag",
                roster.Team,
                "Motståndare",
                roster.Opponent ?? string.Empty,
                roster.Location ?? string.Empty,
                null,
                roster.OilPattern.Name,
                roster.Date);
        }

        UpdateRosterEmail email = new(
            context.Payload.RecipientEmail,
            context.Payload.RecipientName,
            formattedAuditLog,
            players.Select(x => x.Name).ToArray(),
            teamLeader,
            context.Payload.ReplyToEmail,
            roster.Season,
            roster.Turn,
            context.Payload.RosterLink,
            context.Payload.UserProfileLink,
            needsAccept,
            matchHead);

        return(email);
    }