Moved mime type detection into model_methods