public ResultService <IEnumerable <T> > Get(IEnumerable <FilterStatement <T> > filterStatements,
                                                    OrderByStatement <T> orderByStatement = null,
                                                    string includeProperties = "")
        {
            try
            {
                Expression <Func <T, bool> > filters = null;
                if (filterStatements != null && filterStatements.Any())
                {
                    var filterService = new FiltersService <T>(filterStatements);
                    var filtersResult = filterService.BuildExpression();
                    if (!filtersResult.Success)
                    {
                        return(ResultService.Fail <IEnumerable <T> >(filtersResult.ErrorCode));
                    }
                    filters = filtersResult.Value as Expression <Func <T, bool> >;
                }

                Func <IQueryable <T>, IOrderedQueryable <T> > orderBy = null;
                if (orderByStatement != null)
                {
                    var orderByService = new OrderByService();
                    var orderByResult  = orderByService.GetOrderBy <T>(orderByStatement);
                    if (!orderByResult.Success)
                    {
                        return(ResultService.Fail <IEnumerable <T> >(orderByResult.ErrorCode));
                    }
                    orderBy = orderByResult.Value as Func <IQueryable <T>, IOrderedQueryable <T> >;
                }

                var result = this._repository.Get(filters, orderBy, includeProperties);
                if (result == null)
                {
                    return(ResultService.Fail <IEnumerable <T> >(ErrorCode.NotFound));
                }
                return(ResultService.Ok <IEnumerable <T> >(result));
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "Failed to get objects from DB");
                return(ResultService.Fail <IEnumerable <T> >(ex));
            }
        }
        public ResultHandler <IAsyncEnumerable <EventModel> > Get(IEnumerable <FilterStatement <EventModel> > filterStatements,
                                                                  OrderByStatement <EventModel> orderByStatement = null,
                                                                  string includeProperties = "")
        {
            try
            {
                IEnumerable <Expression <Func <EventModel, bool> > > filters = null;
                if (filterStatements != null)
                {
                    var filtersResult = this._filtersService.BuildExpressions(filterStatements);
                    if (!filtersResult.Success)
                    {
                        return(ResultHandler.Fail <IAsyncEnumerable <EventModel> >(filtersResult.ErrorCode));
                    }
                    filters = filtersResult.Value;
                }

                Func <IQueryable <EventModel>, IOrderedQueryable <EventModel> > orderBy = null;
                if (orderByStatement != null)
                {
                    var orderByService = new OrderByService();
                    var orderByResult  = orderByService.GetOrderBy <EventModel>(orderByStatement);
                    if (!orderByResult.Success)
                    {
                        return(ResultHandler.Fail <IAsyncEnumerable <EventModel> >(orderByResult.ErrorCode));
                    }
                    orderBy = orderByResult.Value as Func <IQueryable <EventModel>, IOrderedQueryable <EventModel> >;
                }

                IAsyncEnumerable <EventModel> result = this._repository.Get(filters, orderBy, includeProperties);

                return(ResultHandler.Ok(result));
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "Failed to get objects from DB");
                return(ResultHandler.Fail <IAsyncEnumerable <EventModel> >(ex));
            }
        }