GetAllPackages() public method

Gets all packages.
public GetAllPackages ( int categoryId ) : IEnumerable
categoryId int The category identifier.
return IEnumerable
        private void LoadPackages()
        {
            // get category
            int? categoryId = null;

            if ( !string.IsNullOrWhiteSpace( GetAttributeValue( "CategoryId" ) ) )
            {
                categoryId = Convert.ToInt32(GetAttributeValue( "CategoryId" ));
            }
            else if ( !string.IsNullOrWhiteSpace( PageParameter( "CategoryId" ) ) )
            {
                categoryId = Convert.ToInt32( PageParameter( "CategoryId" ) );
            }

            string categoryName = PageParameter( "CategoryName" );
            if ( GetAttributeValue( "SetPageTitle" ).AsBoolean() && !string.IsNullOrWhiteSpace(categoryName) )
            {
                string pageTitle = "Items for " + categoryName;
                RockPage.PageTitle = pageTitle;
                RockPage.BrowserTitle = String.Format( "{0} | {1}", pageTitle, RockPage.Site.Name );
                RockPage.Header.Title = String.Format( "{0} | {1}", pageTitle, RockPage.Site.Name );
            }

            PackageService packageService = new PackageService();
            var packages = packageService.GetAllPackages( categoryId );

            var mergeFields = new Dictionary<string, object>();
            mergeFields.Add( "CurrentPerson", CurrentPerson );

            // add link to detail page
            Dictionary<string, object> linkedPages = new Dictionary<string, object>();
            linkedPages.Add( "DetailPage", LinkedPageUrl( "DetailPage", null ) );
            mergeFields.Add( "LinkedPages", linkedPages );

            var globalAttributeFields = Rock.Web.Cache.GlobalAttributesCache.GetMergeFields( CurrentPerson );
            globalAttributeFields.ToList().ForEach( d => mergeFields.Add( d.Key, d.Value ) );

            mergeFields.Add( "Packages", packages );

            lOutput.Text = GetAttributeValue( "LavaTemplate" ).ResolveMergeFields( mergeFields );

            // show debug info
            if ( GetAttributeValue( "EnableDebug" ).AsBoolean() && IsUserAuthorized( Authorization.EDIT ) )
            {
                lDebug.Visible = true;
                lDebug.Text = mergeFields.lavaDebugInfo(); ;
            }
        }