public static function toArray( $object, $properties = [], $recursive = TRUE ) {
		if ( is_array( $object ) ) {
			if ( $recursive ) {
				foreach ( $object as $key => $value ) {
					if ( is_array( $value ) || is_object( $value ) ) {
						$object[ $key ] = static::toArray( $value, $properties, TRUE );
					}
				}
			}
			
			return $object;
		} elseif ( is_object( $object ) ) {
			if ( ! empty( $properties ) ) {
				$className = get_class( $object );
				if ( ! empty( $properties[ $className ]) ) {
					$result = [];
					foreach ( $properties[ $className ] as $key => $name ) {
						if ( is_int( $key ) ) {
							$result[ $name ] = $object->$name;
						} else {
							$result[ $key ] = static::getValue( $object, $name );
						}
					}
					
					return $recursive ? static::toArray( $result, $properties ) : $result;
				}
			}
			$result = [];
			foreach ( $object as $key => $value ) {
				$result[ $key ] = $value;
			}
			
			return $recursive ? static::toArray( $result, $properties ) : $result;
		} else {
			return [ $object ];
		}
	}