import * as _ from 'lodash'

/**
 * Takes a list of schedules and finds the next id number.
 * @param {Array} schedules
 * @returns {Number} - the largest ID in the list.
 */
function calculateNextScheduleId(schedules) {
	let ids = _(schedules)
			.sortBy('id')
			.pluck('id')
			.value()

	return _.max(ids) + 1
}

export default calculateNextScheduleId

@@ -219,19 +219,21 @@
  %7B%0A%09let 
-ids
+maxId
  = _(sch
@@ -246,16 +246,14 @@
 )%0A%09%09
-%09.sortBy
+.pluck
 ('id
@@ -257,31 +257,23 @@
 'id')%0A%09%09
-%09.pluck('id'
+.max(
 )%0A
-%09
 %09%09.value
@@ -288,18 +288,13 @@
 urn 
-_.
 max
-(ids)
+Id
  + 1

Reorder some operations in calculateNextScheduleId