/// <summary>
        /// Sets the message count for the given server statistic entity.
        /// </summary>
        /// <param name="globalStats">The server statistics.</param>
        /// <param name="totalMessageCount">The new message count.</param>
        /// <param name="ct">The cancellation token in use.</param>
        /// <returns>A modification result which may or may not have succeeded.</returns>
        public async Task <ModifyEntityResult> SetTotalMessageCountAsync
        (
            UserServerStatistics globalStats,
            long?totalMessageCount,
            CancellationToken ct = default
        )
        {
            globalStats.TotalMessageCount = totalMessageCount;
            await _database.SaveChangesAsync(ct);

            return(ModifyEntityResult.FromSuccess());
        }
        /// <summary>
        /// Updates the timestamp of the given server statistic entity to the current time.
        /// </summary>
        /// <param name="globalStats">The server statistics.</param>
        /// <param name="ct">The cancellation token in use.</param>
        /// <returns>A modification result which may or may not have succeeded.</returns>
        public async Task <ModifyEntityResult> UpdateTimestampAsync
        (
            UserServerStatistics globalStats,
            CancellationToken ct = default
        )
        {
            var now = DateTime.UtcNow;

            if (globalStats.LastActivityTime == now)
            {
                return(ModifyEntityResult.FromError("That's already the latest timestamp."));
            }

            if (globalStats.LastActivityTime > now)
            {
                return(ModifyEntityResult.FromError("That timestamp is earlier than the current timestamp."));
            }

            globalStats.LastActivityTime = now;
            await _database.SaveChangesAsync(ct);

            return(ModifyEntityResult.FromSuccess());
        }