Tarek Yehin posted an article on how to create resource galleries programmatically. As already discussed in the past using such approachs will break the support boundaries for MCMS.
A special comment to the approach in Tareks article: we had a customer this week with exactly this code in place (maybe it is the same customer?) called in for a problem that could only show up if a database inconsistancy exists. As outlined earlier we had to reject this service request as the database is in a not supportable state.
And Tarek does not like others to comment on his articles either - he disabled comment for everyone not having a blogger account. :-(
Here for everyone again my earlier posts about usage of undocumented API and direct access to the database: