public override bool addNewOperation <TObject>(TObject modelParam, string userName)
        {
            AddOperationModel model = modelParam as AddOperationModel;

            if (model != null && model != null && ValidationManager.modelIsValid(model))
            {
                DBModelManagers.Abstract.OperationType operationType = model.IsAddOperation ?
                                                                       DBModelManagers.Abstract.OperationType.Income : DBModelManagers.Abstract.OperationType.Outcome;

                ModelsForPersonalOperationModel modelForOperation = new ModelsForPersonalOperationModel
                {
                    CategoryModel = new NameIdClassModel(),
                    CurrencyModel = new CurrencyNameIdRateClass(),
                    OperationType = operationType,
                    SourceModel   = new NameIdClassModel()
                };
                GetModelsForOperationOptions(ref model, modelForOperation);

                Operation newOperation = new Operation()
                {
                    Summ       = Convert.ToDecimal(model.Summ),
                    Date       = model.Date,
                    Commentary = model.Commentary
                };
                PersonalAccountForeignKeyForSetModels fKModel = new PersonalAccountForeignKeyForSetModels
                {
                    CurrencyModel = modelForOperation.CurrencyModel,
                    CategoryModel = modelForOperation.CategoryModel,
                    SourceModel   = modelForOperation.SourceModel,
                    UserId        = userName,
                    OperationType = operationType
                };
                SetIdForForeignKeys(fKModel, DIManager.UnitOfWork, ref newOperation);


                return(AddOperationToDB(newOperation, model.Template));
            }
            return(false);
        }
        /// <summary>
        /// Set ids for equal properties
        /// </summary>
        /// <param name="currencyModel"></param>
        /// <param name="categoryModel"></param>
        /// <param name="sourceModel"></param>
        /// <param name="modelForDb"></param>
        protected override void SetIdForForeignKeys <TObject, TModelForSet>(TModelForSet modelsForSet, IUnitOfWork unitOfWork, ref TObject operationParam)
        {
            Operation operation = operationParam as Operation;
            PersonalAccountForeignKeyForSetModels fKModel = modelsForSet as PersonalAccountForeignKeyForSetModels;

            if (operation != null && fKModel != null)
            {
                if (fKModel.CurrencyModel != null)
                {
                    operation.CurrencyId = fKModel.CurrencyModel.Id;
                }
                if (fKModel.CategoryModel != null)
                {
                    operation.CategoryId = fKModel.CategoryModel.Id;
                }
                if (fKModel.SourceModel != null)
                {
                    operation.SourceId = fKModel.SourceModel.Id;
                }
                operation.UserId = Convert.ToInt32(fKModel.UserId);

                operation.OperationTypeId = Convert.ToInt32(fKModel.OperationType);
            }
        }