Preventing unnecessary file to be persisted