u/danielw/dm-1395

Creating PR for reviewing DM-1395
These two methods are almost identical, can you define one method instead of two?