commit 139a9b5e20ec01117df7f8a602556eae987ffe87
Author: Christian Ehringfeld <c.ehringfeld@t-online.de>
Date:   Sat Oct 10 14:40:22 2015 +0200

    improvements

diff --git a/src/entitymanager.cpp b/src/entitymanager.cpp
index 5f1a516..2da889a 100644
--- a/src/entitymanager.cpp
+++ b/src/entitymanager.cpp
@@ -202,7 +202,7 @@ bool EntityManager::create(QSharedPointer<Entity> &entity,
                               checkDuplicate, validate, relationsIgnoreHasChanged);
 }
 
-bool EntityManager::create(QList<QSharedPointer<Entity> > entities,
+bool EntityManager::create(QList<QSharedPointer<Entity> > &entities,
                            const bool persistRelations, const bool validate,
                            const bool relationsIgnoreHasChanged, const bool checkDuplicate) {
     bool ok = true;
@@ -232,8 +232,8 @@ bool EntityManager::save(QList<QSharedPointer<Entity> > &entities,
                          const bool persistRelations, const bool ignoreHasChanged, const bool validate,
                          const bool relationsIgnoreHasChanged) {
     bool ok = true;
+    auto merged = QList<Entity *>();
     foreach (QSharedPointer<Entity> entity, entities) {
-        auto merged = QList<Entity *>();
         ok = this->saveObject(entity, merged, persistRelations,
                               ignoreHasChanged, validate, relationsIgnoreHasChanged);
         if (!ok) {
diff --git a/src/entitymanager.h b/src/entitymanager.h
index 8eaf35c..5458b90 100644
--- a/src/entitymanager.h
+++ b/src/entitymanager.h
@@ -69,7 +69,7 @@ class EntityManager : public QObject {
      * @param entities
      * @return
      */
-    bool create(QList<QSharedPointer<Entity>> entities,
+    bool create(QList<QSharedPointer<Entity>> &entities,
                 const bool persistRelations = true, const bool validate = true,
                 const bool relationsIgnoreHasChanged = false,
                 const bool checkDuplicate = false);
@@ -270,6 +270,25 @@ class EntityManager : public QObject {
         return false;
     }
 
+    template<class T> QList<QSharedPointer<T>> convertList(const
+    QList<QSharedPointer<Entity>> &list) {
+        QList<QSharedPointer<T>> newList = QList<QSharedPointer<T>>();
+        for (int i = 0; i < list.size(); ++i) {
+            newList.append(list.at(i).objectCast<T>());
+        }
+        return newList;
+    }
+
+    template<class T> QList<QSharedPointer<Entity>> convertToEntityList(
+    const QList<QSharedPointer<T>> &list) {
+        QList<QSharedPointer<Entity>> newList = QList<QSharedPointer<Entity>>();
+        for (int i = 0; i < list.size(); ++i) {
+            QSharedPointer<T> entity = list.at(i);
+            newList.append(entity);
+        }
+        return newList;
+    }
+
   protected:
     bool saveObject(QSharedPointer<Entity> &entity, QList<Entity *> &mergedObjects,
                     const bool persistRelations = true,
@@ -282,15 +301,6 @@ class EntityManager : public QObject {
                       QList<Entity *> &mergedObjects, const bool persistRelations,
                       const bool checkDuplicate, const bool validate,
                       const bool relationsIgnoreHasChanged = false);
-    template<class T> QList<QSharedPointer<T>> convertList(const
-    QList<QSharedPointer<Entity>> &list) {
-        QList<QSharedPointer<T>> newList = QList<QSharedPointer<T>>();
-        for (int i = 0; i < list.size(); ++i) {
-            newList.append(list.at(i).objectCast<T>());
-        }
-        return newList;
-    }
-
     void init(bool inspect, const MsgType msgType);
     QList<QHash<QString, QVariant> > findAll(const QSharedPointer<Entity> &e);
     void resolveRelations(const QSharedPointer<Entity> &entity,
