public static function insertMedia($mediaFiles, $postID, $postTypeSlug, $languages, $notTranslatableFiles, $filesToBeIgnored = [])
    {
        $imagesArr = array();
        foreach($mediaFiles as $fileKey => $files){
            // feature image is treated as a default column
            if($fileKey == 'featuredImage'
                || $fileKey == 'featuredVideo'
                || in_array($fileKey, $filesToBeIgnored)
                || substr($fileKey, 0, 6) == 'plugin'
            ) {
                continue;
            }
            //if not translatable
            if(in_array($fileKey, $notTranslatableFiles)) {
                foreach ($files as $file){
                    $image = array();
                    $image['field'] = $fileKey;
                    $image['mediaID'] = $file['mediaID'];
                    $image['postID'] = $postID;

                    $languageAvailability = array();
                    foreach ($languages as $lang){
                        $languageAvailability[$lang['slug']] = true;
                    }
                    $image['language'] = json_encode($languageAvailability);
                    array_push($imagesArr, $image);
                }
            }else{ // if translatable
                $explodedFileKey = explode("__lang__", $fileKey);  // remove the "__lang__" part
                $fieldName = $explodedFileKey[0]; // The input name
                $langSlug = $explodedFileKey[1];  // The lang slug
                foreach ($files as $file){
                    $image['field'] = $fieldName;
                    $image['mediaID'] = $file['mediaID'];
                    $image['postID'] = $postID;

                    //store only the language which the input belongs to
                    $languageAvailability = array();
                    foreach ($languages as $lang){
                        if($lang['slug'] == $langSlug) {
                            $languageAvailability[$lang['slug']] = true;
                        }else{
                            $languageAvailability[$lang['slug']] = false;
                        }
                    }
                    $image['language'] = json_encode($languageAvailability);
                    array_push($imagesArr, $image);
                }
            }
        }

        $mediaSaved = (new MediaRelation())->setTable($postTypeSlug.'_media')->insert($imagesArr);
        if($mediaSaved) {
            return $imagesArr;
        }
        return [];
    }