     if @TopicID is not null and not exists(select 1 from [{databaseOwner}].[{objectQualifier}Topic] where TopicID=@TopicID) begin
         set @TopicID = null
     end	
-    
-    -- get previous visit
-    if  @IsGuest = 0	 begin
-        select @PreviousVisit = LastVisit from [{databaseOwner}].[{objectQualifier}User] where UserID = @UserID
-    end
-    
-    -- update last visit
-    update [{databaseOwner}].[{objectQualifier}User] set 
-        LastVisit = @UTCTIMESTAMP,
-        IP = @IP
-    where UserID = @UserID
 
     -- find missing ForumID/TopicID
     if @MessageID is not null begin

        end
        
    end
    -- update active access
    -- ensure that access right are in place		
        if not exists (select top 1
            UserID	
            from [{databaseOwner}].[{objectQualifier}ActiveAccess] WITH(NOLOCK) 
            where UserID = @UserID )		
            begin
            insert into [{databaseOwner}].[{objectQualifier}ActiveAccess](
            UserID,
            BoardID,
            ForumID,
            IsAdmin, 
            IsForumModerator,
            IsModerator,
            IsGuestX,
            LastActive, 
            ReadAccess,
            PostAccess,
            ReplyAccess,
            PriorityAccess,
            PollAccess,
            VoteAccess,	
            ModeratorAccess,
            EditAccess,
            DeleteAccess,
            UploadAccess,
            DownloadAccess)
            select 
            UserID, 
            @BoardID, 
            ForumID, 
            IsAdmin,
            IsForumModerator,
            IsModerator,
            @IsGuest,
            @UTCTIMESTAMP,
            ReadAccess,
            (CONVERT([bit],sign([PostAccess]&(2)),(0))),
            ReplyAccess,
            PriorityAccess,
            PollAccess,
            VoteAccess,
            ModeratorAccess,
            EditAccess,
            DeleteAccess,
            UploadAccess,
            DownloadAccess			
            from [{databaseOwner}].[{objectQualifier}vaccess] 
            where UserID = @UserID 
            end

                -- ensure that guest access right are in place		
        if not exists (select top 1
            UserID	
            from [{databaseOwner}].[{objectQualifier}ActiveAccess] WITH(NOLOCK) 
            where UserID = @GuestID )		
            begin
            insert into [{databaseOwner}].[{objectQualifier}ActiveAccess](
            UserID,
            BoardID,
            ForumID,
            IsAdmin, 
            IsForumModerator,
            IsModerator,
            IsGuestX,
            LastActive, 
            ReadAccess,
            PostAccess,
            ReplyAccess,
            PriorityAccess,
            PollAccess,
            VoteAccess,	
            ModeratorAccess,
            EditAccess,
            DeleteAccess,
            UploadAccess,
            DownloadAccess)
            select 
            UserID, 
            @BoardID, 
            ForumID, 
            IsAdmin,
            IsForumModerator,
            IsModerator,
            @IsGuest,
            @UTCTIMESTAMP,
            ReadAccess,
            (CONVERT([bit],sign([PostAccess]&(2)),(0))),
            ReplyAccess,
            PriorityAccess,
            PollAccess,
            VoteAccess,
            ModeratorAccess,
            EditAccess,
            DeleteAccess,
            UploadAccess,
            DownloadAccess			
            from [{databaseOwner}].[{objectQualifier}vaccess] 
            where UserID = @GuestID 
            end

            
    -- return information
    select top 1
        ActiveUpdate        = ISNULL(@ActiveUpdate,0),

    -- set IsActiveNow ActiveFlag - it's a default
    set @ActiveFlags = 1;

	  -- find a guest id should do it every time to be sure that guest access rights are in ActiveAccess table
    select top 1 @GuestID = UserID from [{databaseOwner}].[{objectQualifier}User] WITH(NOLOCK) where BoardID=@BoardID and (Flags & 4)=4 ORDER BY Joined DESC
        set @rowcount=@@rowcount
        if (@rowcount > 1)
        begin
