public CommandReturnCode Process(string[] args) { responseBuffer.Length = 0; if (args.Length == 2) { Debug.Assert(args[0].Equals("delete", StringComparison.OrdinalIgnoreCase)); int id; var isIdValid = int.TryParse(args[1], out id); if (isIdValid) { isIdValid = productCatalog.IsExist(id); if (isIdValid) { productCatalog.Delete(id); responseBuffer.Append(string.Format("Product with Id = \"{0}\" has been successfully deleted", id)); responseBuffer.Append(Environment.NewLine); } } if (!isIdValid) { responseBuffer.Append(string.Format("Product with Id = \"{0}\" does not exist", args[1])); responseBuffer.Append(Environment.NewLine); } } else { responseBuffer.Append(usage); } return(CommandReturnCode.Done); }