private static void HandleCreateResult(string resourceType, string key, CreateStatus status) { switch (status) { case CreateStatus.Created: break; case CreateStatus.AlreadyExists: throw new CommandException(string.Format("The {0} \"{1}\" already exists", resourceType, key)); default: throw new ApiException(); } }