Remove sortindex and modified if they are null

Dont' send null values for sortindex and modified if they are not set in
the database. Instead remove them from the resulting array.

See issue #7