@Override
    @ActivityLog(event = OWNERSHIP_CREATED)
    @ReactiveTransactional
    public Mono<Ownership> create(@ActivityParameter(OwnershipCreate.DATA_ENTITY_ID) final long dataEntityId,
                                  final OwnershipFormData formData) {
        return Mono.zip(ownerService.getOrCreate(formData.getOwnerName()),
                titleService.getOrCreate(formData.getTitleName()))
            .map(function((owner, title) -> Tuples.of(owner, title, new OwnershipPojo()
                .setDataEntityId(dataEntityId)
                .setOwnerId(owner.getId())
                .setTitleId(title.getId())
            )))
            .flatMap(function((owner, title, ownership) -> ownershipRepository.create(ownership)
                .map(pojo -> Tuples.of(owner, title, pojo))))
            .flatMap(function((owner, title, ownership) -> {
                if (Boolean.TRUE.equals(formData.getPropagate())) {
                    return propagateIfDEG(ownership, OwnershipPropagateAction.CREATE)
                        .then(Mono.just(Tuples.of(owner, title, ownership)));
                }
                return Mono.just(Tuples.of(owner, title, ownership));
            }))
            .flatMap(function((owner, title, ownership) -> searchEntrypointRepository
                .updateChangedOwnershipVectors(ownership.getId())
                .thenReturn(new OwnershipDto(ownership, owner, title))))
            .flatMap(
                ownershipDto -> dataEntityFilledService.markEntityFilled(dataEntityId, OWNERS).thenReturn(ownershipDto))
            .map(ownershipMapper::mapDto);
    }
@Test
    @DisplayName("Creates ownership, expecting successfully created")
    void testCreateOwnership() {
        final String testOwnerName = UUID.randomUUID().toString();
        final String testTitleName = UUID.randomUUID().toString();
        final long testOwnerId = 2L;
        final long testTitleId = 3L;
        final long testOwnershipId = 15L;

        final OwnershipFormData testOwnershipFromData = new OwnershipFormData()
            .ownerName(testOwnerName)
            .titleName(testTitleName);
        final OwnerPojo owner = createTestOwner(testOwnerId, testOwnerName);
        final TitlePojo title = createTestTitle(testTitleId, testTitleName);
        final OwnershipPojo ownershipPojo = createTestOwnershipPojo(testOwnershipId, owner, title);
        final Ownership ownership = createTestOwnership(testOwnershipId, owner, title);

        when(ownerService.getOrCreate(anyString())).thenReturn(Mono.just(owner));
        when(titleService.getOrCreate(anyString())).thenReturn(Mono.just(title));
        when(ownershipRepository.create(any(OwnershipPojo.class))).thenReturn(Mono.just(ownershipPojo));
        when(searchEntrypointRepository.updateChangedOwnershipVectors(anyLong())).thenReturn(Mono.just(1));
        when(ownershipMapper.mapDto(any(OwnershipDto.class))).thenReturn(ownership);
        when(dataEntityFilledService.markEntityFilled(anyLong(), any()))
            .thenReturn(Mono.just(new DataEntityFilledPojo()));

        final Mono<Ownership> actualOwnershipMono = ownershipService.create(1L, testOwnershipFromData);

        StepVerifier
            .create(actualOwnershipMono)
            .assertNext(o -> {
                assertThat(o.getId()).isEqualTo(testOwnershipId);
                assertThat(o.getOwner().getId()).isEqualTo(testOwnerId);
                assertThat(o.getOwner().getName()).isEqualTo(testOwnerName);
                assertThat(o.getTitle().getId()).isEqualTo(testTitleId);
                assertThat(o.getTitle().getName()).isEqualTo(testTitleName);
            })
            .verifyComplete();
        verify(ownerService, only()).getOrCreate(any(String.class));
        verify(titleService, only()).getOrCreate(any(String.class));
        verify(ownershipRepository, times(1)).create(any(OwnershipPojo.class));
        verify(searchEntrypointRepository, times(1))
            .updateChangedOwnershipVectors(testOwnershipId);
        verify(ownershipMapper, only()).mapDto(any(OwnershipDto.class));
    }