public ApAddApplicationResponse AddApplication(ApAddApplicationRequest request) { Log.Debug(this, "AddApplication()"); try { Authenticate(request); Log.Info(this, "Application " + request.Application.Name + " received"); if (!ControllerUtil.ApplicationExists(request.Application)) { string filePath = Settings.ApplicationStorePath + Path.DirectorySeparatorChar + request.Application.FileName; if (!MonoscapeUtil.WebConfigExistsInRoot(filePath)) { if (File.Exists(filePath)) { File.Delete(filePath); } throw new MonoscapeException("Application package is not valid. Re-package the application excluding any project folders and try again."); } try { Database.GetInstance().Applications.Add(request.Application); Database.GetInstance().Commit(); Log.Debug(this, "Application added to the database"); } catch (Exception) { Log.Debug(this, "Application package not found"); } } else { Log.Debug(this, "Application already exists in the database"); } return(new ApAddApplicationResponse()); } catch (Exception e) { Log.Error(this, e); throw e; } }