public IActionResult Import(string file)
        {
            var filePath = Path.Combine(_hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data), file);

            if (string.IsNullOrEmpty(file) || !System.IO.File.Exists(filePath))
            {
                return(NotFound());
            }


            var xd = new XmlDocument {
                XmlResolver = null
            };

            xd.Load(filePath);

            var userId  = _backofficeSecurityAccessor.BackOfficeSecurity.GetUserId().ResultOr(0);
            var element = XElement.Parse(xd.InnerXml);

            _packageDataInstallation.ImportDocumentType(element, userId);

            // Try to clean up the temporary file.
            try
            {
                System.IO.File.Delete(filePath);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error cleaning up temporary udt file in {File}", filePath);
            }

            return(Ok());
        }
        public HttpResponseMessage Import(string file)
        {
            var filePath = Path.Combine(IOHelper.MapPath(SystemDirectories.Data), file);

            if (string.IsNullOrEmpty(file) || !System.IO.File.Exists(filePath))
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            var dataInstaller = new PackageDataInstallation(Logger, Services.FileService, Services.MacroService, Services.LocalizationService,
                                                            Services.DataTypeService, Services.EntityService, Services.ContentTypeService, Services.ContentService, _propertyEditors, _scopeProvider);

            var xd = new XmlDocument {
                XmlResolver = null
            };

            xd.Load(filePath);

            var userId  = Security.GetUserId().ResultOr(0);
            var element = XElement.Parse(xd.InnerXml);

            dataInstaller.ImportDocumentType(element, userId);

            // Try to clean up the temporary file.
            try
            {
                System.IO.File.Delete(filePath);
            }
            catch (Exception ex)
            {
                Logger.Error <ContentTypeController, string>(ex, "Error cleaning up temporary udt file in App_Data: {File}", filePath);
            }

            return(Request.CreateResponse(HttpStatusCode.OK));
        }