It will be good move this logic related to retrieve the owner of the file to another method and avoid to have all those operations inside one big method