/// <summary>
 /// Asynchronously loads first record from query.
 /// Throws exception, if query doesn't return any records.
 /// </summary>
 /// <typeparam name="TSource">Query element type.</typeparam>
 /// <param name="source">Source query.</param>
 /// <param name="token">Optional asynchronous operation cancellation token.</param>
 /// <returns>First record from query results.</returns>
 public static Task <TSource> FirstAsyncLinqToDB <TSource>(
     this IQueryable <TSource> source,
     CancellationToken token = default)
 => AsyncExtensions.FirstAsync(source.ToLinqToDB(), token);
 /// <summary>
 /// Asynchronously loads first record from query, filtered using provided predicate.
 /// Throws exception, if query doesn't return any records.
 /// </summary>
 /// <typeparam name="TSource">Query element type.</typeparam>
 /// <param name="source">Source query.</param>
 /// <param name="predicate">Query filter predicate.</param>
 /// <param name="token">Optional asynchronous operation cancellation token.</param>
 /// <returns>First record from query results.</returns>
 public static Task <TSource> FirstAsyncLinqToDB <TSource>(
     this IQueryable <TSource> source,
     Expression <Func <TSource, bool> > predicate,
     CancellationToken token = default)
 => AsyncExtensions.FirstAsync(source.ToLinqToDB(), predicate, token);
 /// <summary>
 /// Returns the first element of a sequence that satisfies a specified condition
 /// </summary>
 /// <typeparam name="TSource"></typeparam>
 /// <param name="source">An sequence to return an element from</param>
 /// <param name="predicate">A function to test each element for a condition</param>
 /// <returns>The first element in source that passes the test in predicate</returns>
 public static Task <TSource> FirstAsync <TSource>(this IQueryable <TSource> source,
                                                   Expression <Func <TSource, bool> > predicate = null)
 {
     return(predicate == null?AsyncExtensions.FirstAsync(source) : AsyncExtensions.FirstAsync(source, predicate));
 }