public function reorderOnProperty(int $id, int $newIndex, string $propertyName, string $groupingPropertyName = null)
    {
        $columnName = $this->mapper->getDefinition()->getPropertyColumnMap()[$propertyName] ?? null;

        if (!$columnName) {
            throw InvalidArgumentException::format(
                'Invalid call to %s::%s: could not find column linked to property %s::$%s',
                get_class($this), __FUNCTION__, $this->getEntityType(), $propertyName
            );
        }

        $query = $this->reorder($columnName)
            ->withPrimaryKey($id)
            ->toNewIndex($newIndex);

        if ($groupingPropertyName) {
            $groupingColumnNames = $this->mapper->getDefinition()->getEmbeddedColumnsMappedTo($groupingPropertyName);

            $query->groupedBy(...$groupingColumnNames);
        }

        $query->executeOn($this->connection);
    }