private Expression <Func <Company, bool> > GetWhereExpression(CompanyFiltersViewModel filters)
        {
            Expression <Func <Company, bool> > where = x => true;

            if (filters == null)
            {
                return(where);
            }

            if (!string.IsNullOrWhiteSpace(filters.Keyword))
            {
                var term = filters.Keyword.ToUpper();
                where = where.And(x => (x.Name.ToUpper().Contains(term) || x.Employee.Any(y => y.FirstName.ToUpper().Contains(term)) || x.Employee.Any(y => y.LastName.ToUpper().Contains(term))));
            }

            if (filters.EmployeeDateOfBirthFrom.HasValue && filters.EmployeeDateOfBirthTo.HasValue)
            {
                where = where.And(x => x.Employee.Any(y => filters.EmployeeDateOfBirthFrom.Value < y.DateOfBirth && filters.EmployeeDateOfBirthTo.Value > y.DateOfBirth));
            }

            if (filters.EmployeeJobTitles != null)
            {
                where = where.And(x => x.Employee.Any(y => filters.EmployeeJobTitles.Contains(y.JobTitle.ToString())));
            }

            return(where);
        }
        public IActionResult SearchCompany([FromBody] CompanyFiltersViewModel filters)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(filters));
            }

            Log.Debug("Entering search company action...");

            var where = GetWhereExpression(filters);
            var result = new CompanyFiltersResultViewModel {
                Results = _companyService.SearchCompany(where)
            };

            return(Ok(result));
        }