// Add a server. public async Task <string> AddServer(Server server) { // Check if the object has all the needed fields. if (server.ServerId == null) { return("bad"); } if (server.ServerURL == null) { return("bad"); } if (server.ServerURL.EndsWith('/')) { server.ServerURL = server.ServerURL.Substring(0, server.ServerURL.Length - 1); } // If the addition was successful return the id of the server. if (await database.AddServer(server)) { return(server.ServerId); } // If not, it means that the key wasn't unique - return "key". return("key"); }