@SuppressWarnings("unchecked")
    public static Builder fromMap(final Map<String, Object> data) {
        final Action action = Action.valueOf(data.getOrDefault(ACTION, DEFAULT_ACTION.name()).toString().toUpperCase());
        final long sequence = ObjectHelper.cast(Long.class, data.getOrDefault(SEQUENCE, DEFAULT_SEQUENCE));
        final Map<String, Object> inputData = ObjectHelper.cast(Map.class, data.getOrDefault(DATA, Collections.emptyMap()));

        return new Builder()
                .withAction(action)
                .withData(inputData)
                .withSequence(sequence);
    }
@Test
    void testIfNotCreateFromMapFromInvalidData() {
        final LinkedHashMap<String, Object> data = new LinkedHashMap<>();
        data.put(StitchMessage.ACTION, "upsert");
        data.put(StitchMessage.DATA, 1);
        data.put(StitchMessage.SEQUENCE, 1122544L);

        assertThrows(IllegalArgumentException.class, () -> StitchMessage
                .fromMap(data));
    }