public static T GetById <T, TId>(this IQueryable <T> queryable, TId id)
            where T : IHasId <TId>
        {
            var lambda = EntityExpressionUtils.CreateIdPropertyEqualsConstExpression <T, TId>(id);

            T t = queryable.FirstOrDefault(lambda);

            RepositoryHelpers.ThrowIfGetFailed(t, id);

            return(t);
        }
        public static async Task <T> GetByIdAsync <T, TId>(this IQueryable <T> queryable, IQueryableExtensionsResolver repository, TId id,
                                                           CancellationToken cancellationToken = default(CancellationToken))
            where T : IHasId <TId>
        {
            var lambda = EntityExpressionUtils.CreateIdPropertyEqualsConstExpression <T, TId>(id);

            T t = await queryable.Where(lambda).FirstOrDefaultAsync(repository, cancellationToken);

            RepositoryHelpers.ThrowIfGetFailed(t, id);

            return(t);
        }