checkAndClean(object, isNewObject = false, errors = {}) {
    if (!this.model || Object.keys(this.model).length === 0) {
      return Bluebird.resolve({
        ok: true,
        body: object
      });
    }

    let flattenObject = dot.dot(object); // transform the object to a flatten one

    return this._checkData(object, flattenObject, isNewObject, errors)
      .then(checkResults => {
        if (checkResults.ok) {
          return validation.formatDependingOnPolicy(this, flattenObject, object)
            .then(response => {
              dot.object(response); // un-flatten the object, dot re-inject the response into the given var
              // returns the cleaned object
              return Bluebird.resolve({
                ok: true,
                body: response
              });
            });
        }
        return Bluebird.resolve(checkResults);
      });
  }
/**
   * Check an object format and performs some cleanup
   * @param object
   * @param isNewObject boolean - does the check aims to test an object creation ?
   * @param errors - allow to inject errors for testing purposes
   * @returns {*}
   */
Check an object format and performs some cleanup
@param object
@param isNewObject boolean - does the check aims to test an object creation .
@param errors - allow to inject errors for testing purposes
@returns {*}
Check an object format and performs some cleanup @param object @param isNewObject boolean - does the check aims to test an object creation . @param errors - allow to inject errors for testing purposes @returns { * }
checkAndClean(object, isNewObject = false, errors = {}) {
    if (!this.model || Object.keys(this.model).length === 0) {
      return Bluebird.resolve({
        ok: true,
        body: object
      });
    }
    let flattenObject = dot.dot(object); 
    return this._checkData(object, flattenObject, isNewObject, errors)
      .then(checkResults => {
        if (checkResults.ok) {
          return validation.formatDependingOnPolicy(this, flattenObject, object)
            .then(response => {
              dot.object(response); 
              return Bluebird.resolve({
                ok: true,
                body: response
              });
            });
        }
        return Bluebird.resolve(checkResults);
      });
  }
checkAndClean ( object , isNewObject = false , errors = { } ) { if ( ! this . model || Object . keys ( this . model ) . length === 0 ) { return Bluebird . resolve ( { ok : true , body : object } ) ; } let flattenObject = dot . dot ( object ) ; return this . _checkData ( object , flattenObject , isNewObject , errors ) . then ( checkResults => { if ( checkResults . ok ) { return validation . formatDependingOnPolicy ( this , flattenObject , object ) . then ( response => { dot . object ( response ) ; return Bluebird . resolve ( { ok : true , body : response } ) ; } ) ; } return Bluebird . resolve ( checkResults ) ; } ) ; }
Check an object format and performs some cleanup
 @param object
 @param isNewObject boolean - does the check aims to test an object creation ?
Check an object format and performs some cleanup @param object @param isNewObject boolean - does the check aims to test an object creation ?
// transform the object to a flatten one // un-flatten the object, dot re-inject the response into the given var // returns the cleaned object