function doQuery(options) {
            return models.Webhook.getByEventAndTarget(options.data.webhooks[0].event, options.data.webhooks[0].target_url, _.omit(options, ['data']))
                .then((webhook) => {
                    if (webhook) {
                        return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.webhooks.webhookAlreadyExists')}));
                    }

                    return models.Webhook.add(options.data.webhooks[0], _.omit(options, ['data']));
                })
                .then((model) => {
                    return {
                        webhooks: [model.toJSON(options)]
                    };
                });
        }
function doQuery(options) {
            return models.Webhook.getByEventAndTarget(options.data.webhooks[0].event, options.data.webhooks[0].target_url, _.omit(options, ['data']))
                .then((webhook) => {
                    if (webhook) {
                        return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.webhooks.webhookAlreadyExists')}));
                    }

                    return models.Webhook.add(options.data.webhooks[0], _.omit(options, ['data']));
                })
                .then((model) => {
                    return {
                        webhooks: [model.toJSON(options)]
                    };
                });
        }
function doQuery ( options ) { return models . Webhook . getByEventAndTarget ( options . data . webhooks [ 0 ] . event , options . data . webhooks [ 0 ] . target_url , _ . omit ( options , [ 'data' ] ) ) . then ( ( webhook ) => { if ( webhook ) { return Promise . reject ( new common . errors . ValidationError ( { message : common . i18n . t ( 'errors.api.webhooks.webhookAlreadyExists' ) } ) ) ; } return models . Webhook . add ( options . data . webhooks [ 0 ] , _ . omit ( options , [ 'data' ] ) ) ; } ) . then ( ( model ) => { return { webhooks : [ model . toJSON ( options ) ] } ; } ) ; }
### Model Query
Make the call to the Model layer
@param {Object} options
@returns {Object} options
### Model Query Make the call to the Model layer
Query for webhooks