function apply(value, entityType) {
    var result;
    if (value && typeof(value) === "object") {
      if (value instanceof Array) {
        result = applyArray(value, entityType);
      } else if (value instanceof Entity) {
        result = value.copy();
      } else {
        result = createObject(value, entityType);
      }
    }
    return result || value;
  }
// inner function to detect type of property value -- simple or complex

inner function to detect type of property value -- simple or complex
inner function to detect type of property value -- simple or complex
function apply(value, entityType) {
    var result;
    if (value && typeof(value) === "object") {
      if (value instanceof Array) {
        result = applyArray(value, entityType);
      } else if (value instanceof Entity) {
        result = value.copy();
      } else {
        result = createObject(value, entityType);
      }
    }
    return result || value;
  }
function apply ( value , entityType ) { var result ; if ( value && typeof ( value ) === "object" ) { if ( value instanceof Array ) { result = applyArray ( value , entityType ) ; } else if ( value instanceof Entity ) { result = value . copy ( ) ; } else { result = createObject ( value , entityType ) ; } } return result || value ; }
inner function to detect type of property value -- simple or complex
inner function to detect type of property value -- simple or complex