Refactor FilesControllerBehavior#create_and_save_generic_file so that it can be reused