public async Task SaveServerProperties(string id, ServerProperties properties) { var server = await _repo.GetServerById(id); if (server == null) { throw new Exception("Server not found."); } else if (server.TimesRan == 0) { throw new Exception("You must first run the server to generate neccessary files before saving."); } try { server.Properties = properties as Properties; await _repo.UpsertServer(server); await properties.Save(Path.Combine(server.ServerPath, "server.properties")); } catch (Exception ex) { throw ex; } return; }