public async Task <Response <CompanyDetailAdminDTO> > GetCompanyDetail(Guid companyId) { var companiesEntity = await _companiesRepository.GetDetail(companyId); if (companiesEntity == null) { return(new NotFoundErrorResponse <CompanyDetailAdminDTO>()); } var companyDto = _mapper.Map <CompanyDetailAdminDTO>(companiesEntity); var usersCompaniesEntityList = (await _companiesUsersRepository.GetUsersByCompanies(new [] { companyDto.Id })).ToList(); companyDto.UsersCount = usersCompaniesEntityList.Count(x => x.User.Status != UserStatus.Active); companyDto.Admins = _mapper.Map <IEnumerable <UserWithRoleDTO> >(usersCompaniesEntityList.Where(x => x.Status != MembershipStatus.Member)); return(new Response <CompanyDetailAdminDTO> { Data = companyDto }); }