public async System.Threading.Tasks.Task <OperationResult <Task> > DeleteTask(int id) { return(await System.Threading.Tasks.Task.Factory.StartNew <OperationResult <Task> >(() => { OperationResult <Task> result = new OperationResult <Task>(); try { Task task = TasksRepository.Read(id); if (task != null) { if (IsInCompany(task.CompanyId)) { result.Result = TasksRepository.Delete(id); } } } catch (Exception ex) { LoggingService.Log(ex); } return result; })); }