public OperationResult<OperationResults, int?> CreateUser(int? creatorID, AdminUser user)
        {
            var output = new OperationResult<OperationResults, int?>() { Result = OperationResults.Success };

            using (var context = this.CreateMainContext())
            {
                if(context.Connection.State != System.Data.ConnectionState.Open)
                    context.Connection.Open();

                try
                {
                    if (!this.CheckLogin(context, user.Login))
                        return new OperationResult<OperationResults, int?>() { Result = OperationResults.Failure };

                    context.Transaction = context.Connection.BeginTransaction();

                    var profile = new AdminUserProfileRecord()
                    {
                        FirstName = user.FirstName,
                        MiddleName = user.MiddleName,
                        LastName = user.LastName,
                        Email = user.Email
                    };

                    context.AdminUserProfileRecords.InsertOnSubmit(profile);
                    context.SubmitChanges();

                    var member = new AdminUserMembershipRecord()
                    {
                        Login = user.Login,
                        Password = this.PasswordUtility.HashPassword(user.Password, this.PasswordHashKey),
                        ProfileID = profile.ID,
                        IsActive = user.IsActive
                    };
                    context.AdminUserMembershipRecords.InsertOnSubmit(member);
                    context.SubmitChanges();

                    context.AdminUserToRoleRecords.InsertOnSubmit(new AdminUserToRoleRecord() { RoleID = (int)user.Roles.Value, MemberID = member.ID });
                    context.SubmitChanges();

                    context.Transaction.Commit();

                    output.Output = member.ID;
                }
                catch(Exception ex)
                {
                    output.Result = OperationResults.Failure;

                    this.Logger.WriteError(ex);

                    if (context.Transaction != null)
                        context.Transaction.Rollback();
                }

                return output;
            }
        }
 partial void UpdateAdminUserProfileRecord(AdminUserProfileRecord instance);
 partial void DeleteAdminUserProfileRecord(AdminUserProfileRecord instance);
 partial void InsertAdminUserProfileRecord(AdminUserProfileRecord instance);