public async ValueTask <long> CreateAsync(Company organization, CancellationToken cancellationToken = default) { // fix. SqlException: Cannot insert explicit value for identity column in table 'Address' when IDENTITY_INSERT is set to OFF. // * assign to 0 otherwise ValueGeneratedOnAdd() is not working organization.Id = 0L; organization.MainAddressId = 0L; organization.MainAddress.Id = 0L; _addressRepository.Add(organization.MainAddress); await _addressRepository.CommitAsync(cancellationToken); _companyRepository.Add(organization); await _companyRepository.CommitAsync(cancellationToken); return(organization.Id); }