EntityActionPointer InterfaceActionFactory::factory(EntityActionType type,
                                                    const QUuid& id,
                                                    EntityItemPointer ownerEntity,
                                                    QVariantMap arguments) {
    EntityActionPointer action = interfaceActionFactory(type, id, ownerEntity);
    if (action) {
        bool ok = action->updateArguments(arguments);
        if (ok) {
            if (action->lifetimeIsOver()) {
                return nullptr;
            }
            return action;
        }
    }
    return nullptr;
}
EntityActionPointer InterfaceActionFactory::factoryBA(EntityItemPointer ownerEntity, QByteArray data) {
    QDataStream serializedArgumentStream(data);
    EntityActionType type;
    QUuid id;

    serializedArgumentStream >> type;
    serializedArgumentStream >> id;

    EntityActionPointer action = interfaceActionFactory(type, id, ownerEntity);

    if (action) {
        action->deserialize(data);
        if (action->lifetimeIsOver()) {
            return nullptr;
        }
    }

    return action;
}