Refactored the FunctionController.Import action method