message: API: Fix Directory toObject transform
  At least regarding the media.ts unit tests.
diff: import {IDirectory} from '../../../../shared/models/mediaManager/IDirectory';
  import {File} from './File';
  import * as mongoose from 'mongoose';
  -import {ObjectID} from 'bson';
  +import {extractSingleMongoId} from '../../utilities/ExtractMongoId';
  interface IDirectoryModel extends IDirectory, mongoose.Document {
  @@ -28,21 +28,13 @@ const directorySchema = new mongoose.Schema({
  timestamps: true,
  toObject: {
  transform: function (doc: IDirectoryModel, ret: any) {
  - if (!ret._id || ret._id instanceof ObjectID) {
  - ret._id = ret._id.toString();
  + ret._id = extractSingleMongoId(ret);
  + if (doc.populated('subDirectories') === undefined) {
  + ret.subDirectories = ret.subDirectories.map(extractSingleMongoId);
  }
  - ret.subDirectories = ret.subDirectories.map((dir: any) => {
  - if (!dir._id || dir._id instanceof ObjectID) {
  - dir = dir.toString();
  + if (doc.populated('files') === undefined) {
  + ret.files = ret.files.map(extractSingleMongoId);
  }
  - return dir;
  - });
  - ret.files = ret.files.map((file: any) => {
  - if (!file._id || file._id instanceof ObjectID) {
  - file = file.toString();
  - }
  - return file;
  - });
  }
  },
  });
  