Changed query on file_managed table to use EntityFieldQuery class.