public async Task UpdateAsync(Guid currentConsularOfficeId, ConsularOfficeDto newConsularOffice)
        {
            var consularOffice = await _domainContext.ConsularOffices.FirstOrDefaultAsync(e => e.Id == currentConsularOfficeId);

            if (consularOffice != null)
            {
                consularOffice.NameOfTheConsularPost = newConsularOffice.NameOfTheConsularPost;
                consularOffice.CountryOfLocation     = newConsularOffice.CountryOfLocation;
                consularOffice.CityOfLocation        = newConsularOffice.CityOfLocation;
                consularOffice.EmployeeId            = newConsularOffice.EmployeeId;
                consularOffice.TextOfAgreement       = newConsularOffice.TextOfAgreement;
            }
        }
        public ConsularOffice Add(ConsularOfficeDto addedConsularOffice)
        {
            var consularOffice = new ConsularOffice()
            {
                NameOfTheConsularPost = addedConsularOffice.NameOfTheConsularPost,
                CountryOfLocation     = addedConsularOffice.CountryOfLocation,
                CityOfLocation        = addedConsularOffice.CityOfLocation,
                EmployeeId            = addedConsularOffice.EmployeeId,
                TextOfAgreement       = addedConsularOffice.TextOfAgreement,
            };

            _domainContext.ConsularOffices.Add(consularOffice);
            return(consularOffice);
        }
        public async Task <ConsularOffice> CreateOrUpdate(Guid?consularOfficeId, ConsularOfficeDto createdConsularOfficeData)
        {
            if (consularOfficeId == null)
            {
                var consularOffice = _consularOfficeRepository.Add(createdConsularOfficeData);
                await _domainContext.SaveChangesAsync();

                return(await _consularOfficeRepository.GetAsync(consularOffice.Id));
            }

            await _consularOfficeRepository.UpdateAsync(consularOfficeId.Value, createdConsularOfficeData);

            await _domainContext.SaveChangesAsync();

            return(await _consularOfficeRepository.GetAsync(consularOfficeId.Value));
        }