public async Task <DeleteCompanyResultDto> Delete(int id, int userId)
        {
            var company = await _companiesRepository.GetAsync(id, userId);

            if (company == null)
            {
                throw new ValidationException(Messages.CompanyDoesNotExist, nameof(Messages.CompanyDoesNotExist));
            }

            await _companiesRepository.DeleteAsync(company);

            if ((await _companiesRepository.ListAsync(filter: o => o.UserId == userId)).Count == 0)
            {
                var userRole = await _userRolesRepository.GetAsync(filter : o => o.UserId == userId && o.RoleId == (int)Roles.CompanyOwner);

                if (userRole != null)
                {
                    await _userRolesRepository.DeleteAsync(userRole);
                }
            }

            return(new DeleteCompanyResultDto());
        }
        public async Task <Company> DeleteAsync(Guid id)
        {
            var getEntity = await _repository.GetByIdAsync <Company>(id);

            return(await _repository.DeleteAsync(getEntity));
        }