static async create(data) {
        /** @type ObjectID */
        let id;
        let isNew = false;
        if (!data.id) {
            isNew = true;
            id = new ObjectID();
        } else if (typeof data.id === 'string') {
            id = ObjectID.createFromHexString(data.id);
        } else if (data.id instanceof ObjectID) {
            id = data.id;
        } else {
            throw new ValidationError({
                message: 'Invalid ID provided for Milestone'
            });
        }

        const type = validateType(data.type);
        const currency = validateCurrency(type, data?.currency);
        const value = validateValue(data.value);
        const name = validateName(data.name, value, type, currency);
        const emailSentAt = validateEmailSentAt(data);

        /** @type Date */
        let createdAt;
        if (data.createdAt instanceof Date) {
            createdAt = data.createdAt;
        } else if (data.createdAt) {
            createdAt = new Date(data.createdAt);
            if (isNaN(createdAt.valueOf())) {
                throw new ValidationError({
                    message: 'Invalid Date'
                });
            }
        } else {
            createdAt = new Date();
        }

        const milestone = new Milestone({
            id,
            name,
            type,
            value,
            currency,
            createdAt,
            emailSentAt
        });

        if (isNew) {
            milestone.events.push(MilestoneCreatedEvent.create({milestone, meta: data?.meta}));
        }

        return milestone;
    }
@param {any} data
@returns {Promise<Milestone>}