private static function transformData($source, MappingInterface $mapping, $output) {
        $data = [];
        $mappingArray = $mapping->getMapping();

        foreach($mappingArray as $key => $value) {
            $callback = null;
            $found = null;
            $search = null;
            $sourceType = gettype($source);

            // Set Default value
            if(is_array($value) && count($value) === 3) {
                $data[$key] = $value[2];
            }

            // Check if Callback Exists
            if (is_array($value) && count($value) >= 2) {
                $search = $value[0];
                if(is_callable($value[1])) {
                    $callback = $value[1];
                }
                if(is_callable([$mapping, $value[1]])) {
                    $callback = [$mapping, $value[1]];
                }

            } elseif(is_array($value) && count($value) === 1) {
                $search = $value[0];

            } else {
                $search = $value;
            }

            if($sourceType === 'object') {
                // Get the value key form original data
                if(strpos( (string) $search, '.') !== false) {
                    $found = self::objectGet($source, $search);
                } elseif($search !== null && property_exists($source, $search)) {
                    $found = self::objectGet($source, $search);
                }
            } else {
                // Get the value key form original data
                if(strpos( (string) $search, '.') !== false) {
                    $found = self::arrayGet($source, $search);
                } elseif($search !== null && isset($source[$search])) {
                    $found = $source[$search];
                }
            }

            // Check if there need to be a callback.
            if(!is_null($found)) {
                if(!empty($callback)) {
                    $data[$key] = call_user_func($callback, $found, $source);
                } else {
                    $data[$key] = $found;
                }
            } else {
                $data[$key] = null;
            }

        }

        if(is_object($output)) {
            return self::populateObject($output, $data);
        }

        if(is_array($output) && empty($output)) {
            return $data;
        }

        if(is_array($output)){
            $output[] = $data;
        }

        return $output;
    }