private static Mock <IDataService> DataServiceFactory()
        {
            var dataService = new Mock <IDataService>();

            dataService.Setup(ds =>
                              ds.SynchronizeMetaData(
                                  It.IsAny <ContentItem>(),
                                  It.IsAny <IEnumerable <KeyValuePair <string, string> > >(),
                                  It.IsAny <IEnumerable <KeyValuePair <string, string> > >()))
            .Callback <ContentItem, IEnumerable <KeyValuePair <string, string> >, IEnumerable <KeyValuePair <string, string> > >(
                (ci, added, deleted) =>
            {
                deleted.ToList().ForEach(
                    item => dataService.Object.DeleteMetaData(ci, item.Key, item.Value));

                added.ToList().ForEach(
                    item => dataService.Object.AddMetaData(ci, item.Key, item.Value));
            });

            // Register controller types that are dependent on our IDataService.
            var contentController = new ContentController(dataService.Object);

            ComponentFactory.RegisterComponentInstance <IAttachmentController>(new FileController(contentController));
            ComponentFactory.RegisterComponentInstance <IContentController>(contentController);
            ComponentFactory.RegisterComponentInstance <IFileManager>(MockHelper.CreateMockFileManager().Object);

            return(dataService);
        }