public async System.Threading.Tasks.Task <OperationResult <Company> > GetCompanies(int pageSize, int pageNumber, bool descending) { return(await System.Threading.Tasks.Task.Factory.StartNew <OperationResult <Company> >(() => { OperationResult <Company> result = new OperationResult <Company>(); try { result.Count = CompaniesRepository.Count(); if (result.Count > 0) { result.MultipleResult = CompaniesRepository.GetAll(pageSize, pageNumber, descending); } result.Result = true; } catch (Exception ex) { LoggingService.Log(ex); } return result; })); }