public bool Unregister(IOrganizationService client, PluginAssemblyInfo pluginAssemblyInfo = null)
        {
            if (pluginAssemblyInfo == null)
            {
                pluginAssemblyInfo = new PluginAssemblyInfo(this.Assembly);
            }

            var existingAssembly = this.GetExistingQuery(pluginAssemblyInfo.Version).RetrieveSingleRecord(client);

            if (existingAssembly == null)
            {
                return(false);
            }

            // Currently hard-coded to a max of 50 records to delete
            var deletedChildPlugins = new QueryExpression()
            {
                EntityName = PluginType.EntityLogicalName,
                ColumnSet  = new ColumnSet(PluginType.Fields.Name),
                Criteria   = new FilterExpression()
                {
                    Conditions =
                    {
                        new ConditionExpression(PluginType.Fields.PluginAssemblyId,
                                                ConditionOperator.Equal, existingAssembly.Id)
                    }
                }
            };
            var result = deletedChildPlugins.DeleteAllResults(client);

            if (!result)
            {
                return(false);
            }

            existingAssembly.Delete(client);
            return(true);
        }